diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-11-05 11:31:19 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-11-24 11:39:05 +0000 |
commit | b1a9a7794f51dd214e884fe331c5d1009972a48e (patch) | |
tree | 86fdb966c22673144ab3bf912e1d13257f55cc73 /src/gui/kernel/qstylehints.cpp | |
parent | 45a6397e3eefdd98a13bcc59895125779915f445 (diff) |
Add setter for property QStyleHints::showShortcutsInContextMenus
Add a tri-state setter logic similar to the other properties.
Fixes: QTBUG-71471
Change-Id: Iddb5be18a037634a53ad8725bddb91c12fb33fed
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/gui/kernel/qstylehints.cpp')
-rw-r--r-- | src/gui/kernel/qstylehints.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp index b00e6fb0fd..9b5b7a6f1e 100644 --- a/src/gui/kernel/qstylehints.cpp +++ b/src/gui/kernel/qstylehints.cpp @@ -77,6 +77,7 @@ public: int m_cursorFlashTime = -1; int m_tabFocusBehavior = -1; int m_uiEffects = -1; + int m_showShortcutsInContextMenus = -1; int m_wheelScrollLines = -1; int m_mouseQuickSelectionThreshold = -1; }; @@ -358,10 +359,25 @@ bool QStyleHints::showIsMaximized() const \since 5.10 \brief \c true if the platform normally shows shortcut key sequences in context menus, otherwise \c false. + + Since Qt 5.13, the setShowShortcutsInContextMenus() function can be used to + override the platform default. */ bool QStyleHints::showShortcutsInContextMenus() const { - return themeableHint(QPlatformTheme::ShowShortcutsInContextMenus, QPlatformIntegration::ShowShortcutsInContextMenus).toBool(); + Q_D(const QStyleHints); + return d->m_showShortcutsInContextMenus >= 0 + ? d->m_showShortcutsInContextMenus != 0 + : themeableHint(QPlatformTheme::ShowShortcutsInContextMenus, QPlatformIntegration::ShowShortcutsInContextMenus).toBool(); +} + +void QStyleHints::setShowShortcutsInContextMenus(bool s) +{ + Q_D(QStyleHints); + if (s != showShortcutsInContextMenus()) { + d->m_showShortcutsInContextMenus = s ? 1 : 0; + emit showShortcutsInContextMenusChanged(s); + } } /*! |