Skip to content

Commit

Permalink
Qt: Fix PopupClosePolicy::CloseOnClickOutside
Browse files Browse the repository at this point in the history
  • Loading branch information
ogoffart committed Oct 31, 2024
1 parent 908580b commit 3ce0e49
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/backends/qt/qt_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ cpp! {{
void *parent_of_popup_to_close = nullptr;
if (auto p = dynamic_cast<const SlintWidget*>(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;
Expand Down

0 comments on commit 3ce0e49

Please sign in to comment.