summaryrefslogtreecommitdiffstats
path: root/src/plugins/styles
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-06-11 15:06:39 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-06-11 16:21:19 +0000
commita9f82b8b2c19ecc5bf5ab0d376780c34e8435202 (patch)
tree62304ec3c3251c1d92c4e2e020735ed0c4714c17 /src/plugins/styles
parent7a49a62a12119c0a3fd88f24103ea7afbbc24bfa (diff)
Fix breakage of QPushButton on macOS when a style sheet was set
Amends comment 6e1d70ae12baae4610356ec7b69635ad75a97b4e, which introduced SE_PushButtonBevel so that QPushButton could ignore clicks outside of the button's bevel. In the macOS style, make sure that the framerect we pass to NSButton::alignmentRectForFrame is the rect we receive from QPushButton in the style options. The frame property of the shared NSButton* object might not be initialized. In the style sheet style, handle SE_PushButtonBevel the same ways as Contents and FocusRect, as it is not a separately styleable property. Change-Id: I12eb1b046c864a02b34d276e6352e2e16d44231e Fixes: QTBUG-84852 Fixes: QTBUG-84879 Task-number: QTBUG-81452 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit f9940b15f7f0fde731431626172939b9821fd660) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/plugins/styles')
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index f7f3da0256..d0c97dc11c 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -4655,15 +4655,13 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
auto frameRect = cw.adjustedControlFrame(btn->rect);
if (sr == SE_PushButtonContents) {
frameRect -= cw.titleMargins();
- } else {
+ } else if (cw.type != QMacStylePrivate::Button_SquareButton) {
auto *pb = static_cast<NSButton *>(d->cocoaControl(cw));
- if (cw.type != QMacStylePrivate::Button_SquareButton) {
- frameRect = QRectF::fromCGRect([pb alignmentRectForFrame:pb.frame]);
- if (cw.type == QMacStylePrivate::Button_PushButton)
- frameRect -= pushButtonShadowMargins[cw.size];
- else if (cw.type == QMacStylePrivate::Button_PullDown)
- frameRect -= pullDownButtonShadowMargins[cw.size];
- }
+ frameRect = QRectF::fromCGRect([pb alignmentRectForFrame:frameRect.toCGRect()]);
+ if (cw.type == QMacStylePrivate::Button_PushButton)
+ frameRect -= pushButtonShadowMargins[cw.size];
+ else if (cw.type == QMacStylePrivate::Button_PullDown)
+ frameRect -= pullDownButtonShadowMargins[cw.size];
}
rect = frameRect.toRect();
}