diff options
author | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2017-10-11 18:42:32 -0700 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2017-10-17 02:34:35 +0000 |
commit | 198225983df9f402bb368b449f1abeea95ff0dce (patch) | |
tree | 78472fb16f4139bc14f88b34add3a5e30fe8cad3 /src/widgets/kernel/qshortcut.cpp | |
parent | 49da5ce10034161017b261e000d4e9063d962401 (diff) |
QShortcut: Fall back to cross platform code in absence of QPA menu
On macOS, absence of a QPA menu means that we should be using our
own internal logic since there's no entity on the QCocoaMenuDelegate
to take care of the shortcuts.
Change-Id: I35ed8f0b55445f61d0528709d4debb636a502002
Task-number: QTBUG-61039
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/widgets/kernel/qshortcut.cpp')
-rw-r--r-- | src/widgets/kernel/qshortcut.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index 0585a59e89..f944a7097b 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -289,8 +289,10 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge // not the QMenu.) Since we can also reach this code by climbing the menu // hierarchy (see below), or when the shortcut is not a key-equivalent, we // need to check whether the QPA menu is actually disabled. + // When there is no QPA menu, there will be no QCocoaMenuDelegate checking + // for the actual shortcuts. We can then fallback to our own logic. QPlatformMenu *pm = menu->platformMenu(); - if (!pm || !pm->isEnabled()) + if (pm && !pm->isEnabled()) continue; #endif QAction *a = menu->menuAction(); |