From 01d50715e07b54e387ac2a2756a87236273f498b Mon Sep 17 00:00:00 2001 From: Doris Verria Date: Tue, 30 Mar 2021 14:03:43 +0200 Subject: [PATCH] Fix incorrectly-drawn menu indicator for QPushButton on macOS Because the QPushButton's bevel rect is smaller than its actual widget's rect, custom styled menu indicators are drawn outside the bevel frame on macOS. Fix this by drawing the menu indicator inside the bevel's rect instead of the widget's rect. Fixes: QTBUG-90250 Change-Id: Ie63d68d8f564a4a640bdb8e7564f028784faab97 Reviewed-by: Volker Hilsheimer Reviewed-by: Richard Moe Gustavsen (cherry picked from commit 0eb0fc87014b8de06473055bd2298b2423d480f6) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/styles/qstylesheetstyle.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index ef8bf9881b0..3753a9cdb53 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -3542,7 +3542,8 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q if (btn->features & QStyleOptionButton::HasMenu) { QRenderRule subRule = renderRule(w, opt, PseudoElement_PushButtonMenuIndicator); - QRect ir = positionRect(w, rule, subRule, PseudoElement_PushButtonMenuIndicator, opt->rect, opt->direction); + QRect ir = positionRect(w, rule, subRule, PseudoElement_PushButtonMenuIndicator, + baseStyle()->subElementRect(SE_PushButtonBevel, btn, w), opt->direction); if (subRule.hasDrawable()) { subRule.drawRule(p, ir); } else {