From 3ce0e490036ee66f68634b21932631c73713c25d Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 31 Oct 2024 13:46:10 +0100 Subject: [PATCH] Qt: Fix PopupClosePolicy::CloseOnClickOutside --- internal/backends/qt/qt_window.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/backends/qt/qt_window.rs b/internal/backends/qt/qt_window.rs index ab4c1e53ee1..57dff5377c9 100644 --- a/internal/backends/qt/qt_window.rs +++ b/internal/backends/qt/qt_window.rs @@ -160,10 +160,10 @@ cpp! {{ void *parent_of_popup_to_close = nullptr; if (auto p = dynamic_cast(parent())) { void *parent_window = p->rust_window; - bool close_on_click = rust!(Slint_mouseReleaseEventPopup [parent_window: &QtWindow as "void*"] -> bool as "bool" { + bool inside = rect().contains(event->pos()); + bool close_on_click = rust!(Slint_mouseReleaseEventPopup [parent_window: &QtWindow as "void*", inside: bool as "bool"] -> bool as "bool" { let close_policy = parent_window.close_policy(); - - close_policy == PopupClosePolicy::CloseOnClick || close_policy == PopupClosePolicy::CloseOnClickOutside + close_policy == PopupClosePolicy::CloseOnClick || (close_policy == PopupClosePolicy::CloseOnClickOutside && !inside) }); if (close_on_click) { parent_of_popup_to_close = parent_window;