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
Pick-to: 5.15 6.0 6.1
Change-Id: Ie63d68d8f564a4a640bdb8e7564f028784faab97
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Doris Verria 2021-03-30 14:03:43 +02:00
parent 37f9f2e7af
commit 0eb0fc8701

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 {