aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOliver Eftevaag <oliver.eftevaag@qt.io>2025-12-03 14:04:17 +0100
committerOliver Eftevaag <oliver.eftevaag@qt.io>2025-12-19 16:09:14 +0100
commit0c74b65a6627a31c0b3b0e49db0e994bbeecd35a (patch)
treeba3a2af3c8796af4e9f19216b1987b37d52f41f5 /src
parent8bd5f700355a788b4c6c2c1a4116a2b9f8a594f0 (diff)
Popup Windows: Don't close when a pointer event hits the non-client area
On WebAssembly, when clicking on a dialogs TitleBar, the dialog would just close. That's because the event would get forwarded to the dialog that the title bar belongs to, but since the non-client area is outside the dialog window, it would close itself. This behavior was unintended. Fix it by not closing the window if a non-client area was hit. Pick-to: 6.11 6.10 6.8 Change-Id: Id54da63e0eee22f9c3b01301762f633c99821255 Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quicktemplates/qquickpopupwindow.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/quicktemplates/qquickpopupwindow.cpp b/src/quicktemplates/qquickpopupwindow.cpp
index cc19777aff..e576755ae4 100644
--- a/src/quicktemplates/qquickpopupwindow.cpp
+++ b/src/quicktemplates/qquickpopupwindow.cpp
@@ -264,7 +264,9 @@ bool QQuickPopupWindowPrivate::filterPopupSpecialCases(QEvent *event)
// Note that A QQuickPopupWindow can be bigger than the
// menu itself, to make room for a drop-shadow. But if the press was on top
// of the shadow, targetMenu will still be nullptr.
- closePopupAndParentMenus();
+ // On WASM in particular, it's possible for dialogs to receive the event, when clicking in the non-client area. Don't close in those cases.
+ if (event->type() != QEvent::NonClientAreaMouseButtonPress && event->type() != QEvent::NonClientAreaMouseButtonDblClick)
+ closePopupAndParentMenus();
return false;
}
} else if (pe->isUpdateEvent()){
@@ -300,7 +302,9 @@ bool QQuickPopupWindowPrivate::filterPopupSpecialCases(QEvent *event)
} else if (pe->isEndEvent()) {
if (!targetPopup && !targetMenuBar && closePolicy.testAnyFlags(QQuickPopup::CloseOnReleaseOutside | QQuickPopup::CloseOnReleaseOutsideParent)) {
// Released outside either a popup window, or a menu or menubar that owns a menu using popup windows.
- closePopupAndParentMenus();
+ // This should normally close the current popup window, unless it's inside the non-client area, which can happen in WASM dialogs.
+ if (event->type() != QEvent::NonClientAreaMouseButtonRelease)
+ closePopupAndParentMenus();
return false;
}