From 412ec70f14aa0c966d13481a35c498e6c905dec3 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 18 Sep 2014 19:12:17 +0200 Subject: [PATCH] OS X: Fix menu item shortcuts without modifiers A regression was introduced by bdebec4e2ef79f1771d2dcc22f9a919eb4487567. The intention of the change was to avoid using Qt's shortcut mechanism to trigger menu items which were already triggered through the regular menu API in Cocoa. However, Cocoa has trouble with key equivalents that do not have any keyboard modifiers. Thus, we have to allow these particular key sequences to go through the regular system. I've verified that the original bug is still fixed with this change. [ChangeLog][OS X] Fixed menu item shortcuts without keyboard modifiers. Task-number: QTBUG-41192 Change-Id: I8f5a9cbc7a448b3cb0519baed95be5cbb630205c Reviewed-by: Gabriel de Dietrich --- src/widgets/kernel/qshortcut.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index dcf6aed591..3683d6c7ce 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -279,7 +279,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge // (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. - if (a->shortcut().count() <= 1) + if (a->shortcut().count() < 1 || (a->shortcut().count() == 1 && (a->shortcut()[0] & Qt::MODIFIER_MASK) != 0)) continue; #endif QAction *a = menu->menuAction();