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>
bb10
Gabriel de Dietrich 2013-05-03 13:30:01 +02:00 committed by The Qt Project
parent 649fa0b004
commit bdebec4e2e
1 changed files with 10 additions and 0 deletions

View File

@ -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))