From ada1b61991b16f21c5cd9c785dc7fbfa832f18be Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 7 Dec 2017 11:31:08 +0100 Subject: [PATCH] qlineedit: Use QIcon::Active for pressed action button Qt should be using its own API in the way it's meant to be. If there's an issue with Qt's built-in styles it has to be fixed there. Otherwise this causes problems with styles, such as KDE's Breeze, which make use of both Selected and Active states for icons. However, Qt's built-in styles do not have hover effects for tool bar buttons and menu items, so there's somewhat of a conflict here which was probably the reason for the workaround used. Change-Id: Ieaed580f548caf181b1005b4e82e3f2adc1f9ce5 Reviewed-by: Friedemann Kleint Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qlineedit_p.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 6a8af53c970..acf49cda720 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -347,11 +347,9 @@ void QLineEditIconButton::paintEvent(QPaintEvent *) QWindow *window = nullptr; if (const QWidget *nativeParent = nativeParentWidget()) window = nativeParent->windowHandle(); - // Note isDown should really use the active state but in most styles - // this has no proper feedback QIcon::Mode state = QIcon::Disabled; if (isEnabled()) - state = isDown() ? QIcon::Selected : QIcon::Normal; + state = isDown() ? QIcon::Active : QIcon::Normal; const QLineEditPrivate *lep = lineEditPrivate(); const int iconWidth = lep ? lep->sideWidgetParameters().iconSize : 16; const QSize iconSize(iconWidth, iconWidth);