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.9 6.8
Change-Id: Ib59988cfad444f9f8203628d4b3e1f72d6775b46
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Wladimir Leuschner 2025-01-15 16:47:48 +01:00
parent 9a1260e3f9
commit 3f42d2baac

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();