From a4f9cf23444dd76a11d4eb67c4ea65d5c3948894 Mon Sep 17 00:00:00 2001 From: Elvis Angelaccio Date: Sat, 29 Jul 2017 11:28:13 +0200 Subject: Disable window shortcuts if there is a window modal dialog If a window is blocked by a WindowModal dialog, it should not be possible to trigger window shortcuts on that window if it receives a WindowActivate event. This currently happens if the blocked window gets clicked, because the window becomes the active_window and then QApplication sends it a WindowActivate event (this doesn't happen with application modal dialogs). The correctWidgetContext() function calls QApplicationPrivate::tryModalHelper() only if the shortcut context is ApplicationShortcut. This patch makes it call even if the shortcut context is WindowShortcut. Change-Id: Iff87d85bcae603a6a24128e0cedfa9d33b6485fd Reviewed-by: Richard Moe Gustavsen --- src/widgets/kernel/qshortcut.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index f944a7097b..32600d4152 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -205,7 +205,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge #if defined(DEBUG_QSHORTCUTMAP) qDebug().nospace() << "..true [Pass-through]"; #endif - return true; + return QApplicationPrivate::tryModalHelper(w, nullptr); } #if QT_CONFIG(graphicsview) -- cgit v1.2.3