Respect style sheet rules for checked and selected menu items

With a stylesheet that defines a rule for checked:selected menu items,
the rule was never rendered. Instead, the checked rule was used.

The 'act' variable was initialized based on State_Selected being set, but
that state flags was never set on the temporary QStyleOptionMenuItem
used to render the PE_IndicatorMenuCheckMark.

Note: QStyleSheetStyle falls back to QWindowsStyle for this draw path.

Task-number: QTBUG-73966
Pick-to: 6.2
Change-Id: I3044dbe8f60f1896f79af1afdb26094971704616
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Volker Hilsheimer 2021-07-13 13:51:42 +02:00
parent c9db5eed54
commit 70e4a70265

View File

@ -1169,7 +1169,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
if (!dis)
newMi.state |= State_Enabled;
if (act)
newMi.state |= State_On;
newMi.state |= State_On | State_Selected;
newMi.rect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x() + QWindowsStylePrivate::windowsItemFrame,
menuitem->rect.y() + QWindowsStylePrivate::windowsItemFrame,
checkcol - 2 * QWindowsStylePrivate::windowsItemFrame,