commit 96262763c3a5e79d44e9429255e4ad1b591bf857
Author: Juergen Spitzmueller <[email protected]>
Date:   Wed Mar 12 15:18:34 2025 +0100

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

diff --git a/src/frontends/qt/FancyLineEdit.cpp 
b/src/frontends/qt/FancyLineEdit.cpp
index 9f52f7c5c8..fc5b0a7963 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>
 
@@ -136,8 +139,16 @@ void FancyLineEdit::checkButtons(const QString &text)
 
 void FancyLineEdit::setClearButton(bool visible)
 {
-       // FIXME: remove and adapt code
        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
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to