diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2013-05-03 13:30:01 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-08 09:48:01 +0200 |
commit | bdebec4e2ef79f1771d2dcc22f9a919eb4487567 (patch) | |
tree | 587e7afd47517d6fa5346cad9a34a0446f7f5956 /src/widgets | |
parent | 649fa0b004036281327ebce78e000c02acaa5846 (diff) |
Menu item shortcuts reaching Qt's event loop are disabled
See comment in code and Cocoa event dispatching overview at
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html
Task-number: QTBUG-30657
Change-Id: I88907aeeefa4962e1121495cd51af17a8e71b7de
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qshortcut.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index f323c682d1..c5cdce3d60 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -246,9 +246,19 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge QWidget *w = widgets.at(i); #ifndef QT_NO_MENU if (QMenu *menu = qobject_cast<QMenu *>(w)) { +#ifdef Q_OS_MAC + // On Mac, menu item shortcuts are processed before reaching any window. + // That means that if a menu action shortcut has not been already processed + // (and reaches this point), then the menu item itself has been disabled. + // This occurs at the QPA level on Mac, were we disable all the Cocoa menus + // when showing a modal window. + Q_UNUSED(menu); + continue; +#else QAction *a = menu->menuAction(); if (correctActionContext(context, a, active_window)) return true; +#endif } else #endif if (correctWidgetContext(context, w, active_window)) |