From 5dbcddfc328d0ff6578b7c34e2f2afd56bc0de35 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 May 2010 16:01:12 +0100 Subject: [PATCH] Added the ability to suppress a keyboard shortcut from taking effect on a given QAction absolutely --- src/corelib/global/qnamespace.h | 3 ++- src/gui/kernel/qshortcutmap.cpp | 3 +++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 09c000b..d72410f 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1452,7 +1452,8 @@ public: WidgetShortcut, WindowShortcut, ApplicationShortcut, - WidgetWithChildrenShortcut + WidgetWithChildrenShortcut, + InactiveShortcut }; enum FillRule { diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp index 3d344c9..9116c0b 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -662,6 +662,9 @@ bool QShortcutMap::correctWidgetContext(Qt::ShortcutContext context, QWidget *w, if (!visible || !w->isEnabled()) return false; + if (context == Qt::InactiveShortcut) + return false; + if (context == Qt::ApplicationShortcut) return QApplicationPrivate::tryModalHelper(w, 0); // true, unless w is shadowed by a modal dialog -- 1.7.0.2.msysgit.0