QWindows11Style: Make disabled menu item non-selectable

QWindows11Style inherits the stylehint policy for
SH_Menu_AllowActiveAndDisabled from QWindowsVistaStyle, although the
inactive selection is not visible. This patch makes disabled menu items
non-selectable.

Pick-to: 6.8
Change-Id: Ib59988cfad444f9f8203628d4b3e1f72d6775b46
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3f42d2baacf3d227a001e49d74ea97f7ab551ae1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Wladimir Leuschner 2025-01-15 16:47:48 +01:00 committed by Qt Cherry-pick Bot
parent 3780e0edc1
commit a2b68996b2

View File

@ -1783,6 +1783,8 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
int QWindows11Style::styleHint(StyleHint hint, const QStyleOption *opt,
const QWidget *widget, QStyleHintReturn *returnData) const {
switch (hint) {
case QStyle::SH_Menu_AllowActiveAndDisabled:
return 0;
case SH_GroupBox_TextLabelColor:
if (opt!=nullptr && widget!=nullptr)
return opt->palette.text().color().rgba();