summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qcommonstyle.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-10-21 22:42:36 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-10-23 13:04:02 +0200
commita8c6958a875a6c6ad67b5741a5daa89f5340710c (patch)
tree67ed6e301af89c3f817f7bb90beacf03d164e8f3 /src/widgets/styles/qcommonstyle.cpp
parentc3e2a624fbaa63979eecfc0b9346f4b54cb65264 (diff)
Add QPlatformTheme::MenuBarFocusOnAltPressRelease
On Windows, pressing and releasing the Alt key moves focus to the menubar. This is implemented in widgets, but not in Qt Quick. Add a new theme hint so that we can make Qt behave natively on all platforms, and make the common style's respective styleHint default to the theme hint. Change-Id: I101bec56afd51e81ebb128c288f8a1e9b7efedb4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/widgets/styles/qcommonstyle.cpp')
-rw-r--r--src/widgets/styles/qcommonstyle.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 01fb688469..2cb9bc00ba 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -5384,7 +5384,6 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
case SH_Menu_AllowActiveAndDisabled:
case SH_Menu_SpaceActivatesItem:
case SH_ScrollView_FrameOnlyAroundContents:
- case SH_MenuBar_AltKeyNavigation:
case SH_ComboBox_ListMouseTracking:
case SH_Menu_MouseTracking:
case SH_MenuBar_MouseTracking:
@@ -5410,6 +5409,10 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
case SH_Table_AlwaysDrawLeftTopGridLines:
ret = false;
break;
+ case SH_MenuBar_AltKeyNavigation:
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ ret = theme->themeHint(QPlatformTheme::MenuBarFocusOnAltPressRelease).toBool();
+ break;
case SH_CustomBase:
// Added to get compiler errors when a style hint is missing
ret = false;