summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-03-13 13:33:58 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-03-23 15:39:18 +0000
commitfb70893dd5e616356260fe0b391dd77007c7bfc7 (patch)
tree14cbe4fe6777dee98f3ef93198f05e903c2dac6d
parent826b606a5d8f274c55f525119299aef2fe143aaf (diff)
Don't accept QWSI::CloseEvent when the window is blocked by a modal window
If a window is blocked by another modal window, and we decide that as a result we should not propagate the close event, we need to also report this back to the platform plugin, so that it can tell the operating system to not close the window. This is a problem on macOS, where the system doesn't natively support transient parents being blocked by a window-modal window, so the OS will still allow interaction with the title bar close button, resulting in a QWSI close event being delivered. Fixes: QTBUG-104905 Pick-to: 6.5 6.2 Change-Id: I09ff15b0fbb1002a8f9d83d932ca766ed510f0a0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r--src/gui/kernel/qguiapplication.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index dcb7191678..589a054c19 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2706,6 +2706,7 @@ void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::Cl
if (e->window.data()->d_func()->blockedByModalWindow && !e->window.data()->d_func()->inClose) {
// a modal window is blocking this window, don't allow close events through, unless they
// originate from a call to QWindow::close.
+ e->eventAccepted = false;
return;
}