From 70e4a70265d6066ef04c7ed5700dadade72ef44c Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 13 Jul 2021 13:51:42 +0200 Subject: 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 --- src/widgets/styles/qwindowsstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index e6198540a3..8c5b509eb5 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -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, -- cgit v1.2.3