I need to center a newly displayed dialog window (from a Dialog .slint component) on another window (the app's main window). But the size of the dialog window before calling show(), as reported by slint::Window::size() -> PhysicalSize, is 800x600, which is incorrect and simply seems to be a default size on Windows.
Calling Window::request_redraw() before doesn't work. Calling show() directly before centering also doesn't work. As a workaround, I have to defer the centering on the main window with dialog.as_weak().upgrade_in_event_loop(...), which means show() will run before.
Is a function that ensures layouting at a point in time required by the developer missing?
IMHO the bug here is that Window::size don't return the right size before show. It should ideally return the preferred size (clamped to its constraints)
Taken from https://github.com/slint-ui/slint/discussions/6608 :
I need to center a newly displayed dialog window (from a Dialog .slint component) on another window (the app's main window). But the size of the dialog window before calling show(), as reported by slint::Window::size() -> PhysicalSize, is 800x600, which is incorrect and simply seems to be a default size on Windows.
Calling Window::request_redraw() before doesn't work. Calling show() directly before centering also doesn't work. As a workaround, I have to defer the centering on the main window with dialog.as_weak().upgrade_in_event_loop(...), which means show() will run before.
Is a function that ensures layouting at a point in time required by the developer missing?