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 <volker.hilsheimer@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 0eb0fc87014b8de06473055bd2298b2423d480f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Doris Verria 2021-03-30 14:03:43 +02:00 committed by Qt Cherry-pick Bot
parent 917509c914
commit 01d50715e0

View File

@ -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 {