summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorDoris Verria <doris.verria@qt.io>2021-05-04 12:13:39 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-05-07 15:11:06 +0000
commitbe6fce096203c7c792b5934346aa9e15262a52ec (patch)
tree915dbf8372820473b1b586ac5d06a2a01f08a0a1 /src/widgets/styles
parent5ee6a0dddad933161a5a8783afa8d65611d06272 (diff)
Don't draw focus frame if widget has style rules that affect border
Skip drawing the focus ring if the widget has a custom styled border, custom focus ring, or any rule that affects the border. For QPushButton, if the style rule has a background set, the bevel will be drawn in the Windows style. Skip drawing the Mac focus frame in that case too. Fixes: QTBUG-93032 Change-Id: I7c4d4bf6f6ce7bbcd17cd620586c5efa44f2b8d6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 05f7dd5ead5927ef7b3301380b81d7194d9e0593) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 73bd466d77..9a80347d7e 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -123,6 +123,9 @@
#if QT_CONFIG(toolbar)
#include <QtWidgets/qtoolbar.h>
#endif
+#if QT_CONFIG(pushbutton)
+#include <QtWidgets/qpushbutton.h>
+#endif
#include <QtGui/qpainterpath.h>
#include <QtGui/qscreen.h>
@@ -2943,6 +2946,12 @@ void QStyleSheetStyle::polish(QWidget *w)
if (!rule.hasBackground() || rule.background()->isTransparent() || rule.hasBox()
|| (!rule.hasNativeBorder() && !rule.border()->isOpaque()))
w->setAttribute(Qt::WA_OpaquePaintEvent, false);
+ if (rule.hasBox() || !rule.hasNativeBorder()
+#if QT_CONFIG(pushbutton)
+ || (qobject_cast<QPushButton *>(w))
+#endif
+ )
+ w->setAttribute(Qt::WA_MacShowFocusRect, false);
}
}