commit af7a99d4e642af4cf2be6f739a722d0b4f10a646
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Wed Mar 12 15:18:34 2025 +0100

    Fix clear button in FancyLineEdit
    
    Use the icon from the theme and consider dark mode
    
    (cherry picked from commit 96262763c3a5e79d44e9429255e4ad1b591bf857)
---
 src/frontends/qt/FancyLineEdit.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/frontends/qt/FancyLineEdit.cpp 
b/src/frontends/qt/FancyLineEdit.cpp
index 269a717ed4..dbce8666bf 100644
--- a/src/frontends/qt/FancyLineEdit.cpp
+++ b/src/frontends/qt/FancyLineEdit.cpp
@@ -15,6 +15,8 @@
 
 #include "FancyLineEdit.h"
 
+#include "GuiApplication.h"
+
 #include <QEvent>
 #include <QDebug>
 #include <QString>
@@ -26,6 +28,7 @@
 #include <QAbstractButton>
 #include <QPainter>
 #include <QStyle>
+#include <QToolButton>
 #include <QPaintEvent>
 #include <QWindow>
 
@@ -139,6 +142,15 @@ void FancyLineEdit::setClearButton(bool visible)
        // QLineEdit::setClearButtonEnabled() has been implemented in Qt 5.2.
        // This is now the minimum required version
        setClearButtonEnabled(visible);
+       if (visible) {
+               // set a proper clear button which uses the icon theme and
+               // supports dark mode
+               QIcon editclear(guiApp ? guiApp->getScaledPixmap("images/", 
"editclear")
+                                 : getPixmap("images/", "editclear", 
"svgz,png"));
+               QToolButton * clearAction = findChild<QToolButton*>();
+               if (clearAction)
+                       clearAction->setIcon(editclear);
+       }
 }
 
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to