slint
slint copied to clipboard
PopupWindow Improvements
There are some issues with the current PopupWindow
- [x] Clicking anywere closes it, this might not be what we want (#2810)
- [ ] The popup window positioning is a bit of a hack: can't depend of the size of the popup. (#1056)
- [ ] Can't access inner property of the popup from the outside (https://github.com/slint-ui/slint/issues/4438)
- [ ] It doesn't draw anything (no background and border by default)
- [x] Close behaviour is inconsistent (https://github.com/slint-ui/slint/pull/4275)
- [ ] https://github.com/slint-ui/slint/issues/2911
- [ ] https://github.com/slint-ui/slint/issues/3605
- [ ] https://github.com/slint-ui/slint/issues/2899
- [ ] https://github.com/slint-ui/slint/issues/4209
PopupWindow was just build for the need of the ComboBox and cannot really do much more.
We should probably consider having friendlier widgets such as Allowing Dialog
, Window
, ... as child that can be shown
Maybe having MessageBox
or such.
@ogoffart Any update on this? As a desktop application, popups are often used to show info or fatal error messages. Without that, we can only use status bar, which leads to poor user experience. Issue 1 and 4 really need to be resolved for the popup windows to work. It seems that we have the Dialog
s. https://slint-ui.com/releases/1.0.0/docs/slint/src/builtins/elements.html#dialog
Examples to use Dialogs:
https://github.com/slint-ui/slint/blob/master/examples/todo/rust/main.rs#L54-L67
https://github.com/slint-ui/slint/blob/master/examples/todo/ui/todo.slint#L23-L43
@ogoffart It seems that a Dialog still needs to wrapped in a PopupWindow, so that those issues still exist.
NOTE: I'll make a separate issue once I isolate the problem but currently losing focus (app level) with PopupWindow
being up when using Wayland/Sway session causes the popup window to close with a state loss if a state is associated (e.g. awaiting user decision). AFAIK there's no way to assign "this popup has closed for any reason" in a generic way to the popup window to count the user action (e.g. cancellation).
I haven't tested yet if the app-level focus loss does this on other session types, but in Sway it's very bothersome because all it takes is mouse movement. The popup window can also "outgrow" the parent main window so moving the mouse towards any buttons inside it can easily lead to focus loss on i3 like WMs.