Fix label margins for pulldowns with custom styled menu indicator on macOS
Don't apply the QMacStyle's pulldownButton titlemargins to the QPushButton's contents rect if the button has a custom styled menu indicator. This causes the button's text/icon to be misaligned. Fixes: QTBUG-86134 Pick-to: 5.15 6.0 6.1 Change-Id: I6ef95d51071c1d79f1cc07425a46958f50091b7e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>bb10
parent
9211d04730
commit
37f9f2e7af
|
|
@ -5855,6 +5855,13 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
|
|||
case SE_PushButtonBevel:
|
||||
case SE_PushButtonFocusRect:
|
||||
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
|
||||
if (btn->features & QStyleOptionButton::HasMenu
|
||||
&& hasStyleRule(w, PseudoElement_PushButtonMenuIndicator)) {
|
||||
QStyleOptionButton btnOpt(*btn);
|
||||
btnOpt.features &= ~QStyleOptionButton::HasMenu;
|
||||
return rule.baseStyleCanDraw() ? baseStyle()->subElementRect(se, &btnOpt, w)
|
||||
: QWindowsStyle::subElementRect(se, &btnOpt, w);
|
||||
}
|
||||
if (rule.hasBox() || !rule.hasNativeBorder()) {
|
||||
return visualRect(opt->direction, opt->rect, se == SE_PushButtonBevel
|
||||
? rule.borderRect(opt->rect)
|
||||
|
|
|
|||
Loading…
Reference in New Issue