mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-02 04:48:27 +00:00
Add support for manually closing PopupWindows
This patch adds a `close()` function that can be called to close a popup window, and a `close-to-click` boolean that can be set to false to disable the default behavior.
This commit is contained in:
parent
a0a5294e49
commit
0f54b9599b
20 changed files with 349 additions and 24 deletions
|
|
@ -331,6 +331,7 @@ fn gen_corelib(
|
|||
"slint_windowrc_set_focus_item",
|
||||
"slint_windowrc_set_component",
|
||||
"slint_windowrc_show_popup",
|
||||
"slint_windowrc_close_popup",
|
||||
"slint_windowrc_set_rendering_notifier",
|
||||
"slint_windowrc_request_redraw",
|
||||
"slint_windowrc_on_close_requested",
|
||||
|
|
|
|||
|
|
@ -161,13 +161,16 @@ public:
|
|||
}
|
||||
|
||||
template<typename Component, typename Parent>
|
||||
void show_popup(const Parent *parent_component, cbindgen_private::Point p,
|
||||
void show_popup(const Parent *parent_component, cbindgen_private::Point p, bool close_on_click,
|
||||
cbindgen_private::ItemRc parent_item) const
|
||||
{
|
||||
auto popup = Component::create(parent_component).into_dyn();
|
||||
cbindgen_private::slint_windowrc_show_popup(&inner, &popup, p, &parent_item);
|
||||
cbindgen_private::slint_windowrc_show_popup(&inner, &popup, p, close_on_click,
|
||||
&parent_item);
|
||||
}
|
||||
|
||||
void close_popup() const { cbindgen_private::slint_windowrc_close_popup(&inner); }
|
||||
|
||||
template<std::invocable<RenderingState, GraphicsAPI> F>
|
||||
std::optional<SetRenderingNotifierError> set_rendering_notifier(F callback) const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue