Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window::size should return the preferred size before the window is shown. #6724

Open
hunger opened this issue Nov 6, 2024 · 1 comment
Open
Labels
a:layouts Related to the layouting and positioning of the elements (mO,bT) bug Something isn't working priority:low Lowest priority. The issue is kept open for tracking purpose, but noone is actively working on this

Comments

@hunger
Copy link
Member

hunger commented Nov 6, 2024

Taken from #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?

@ogoffart
Copy link
Member

ogoffart commented Nov 6, 2024

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)

@ogoffart ogoffart added need triaging Issue that the owner of the area still need to triage a:layouts Related to the layouting and positioning of the elements (mO,bT) labels Nov 6, 2024
@ogoffart ogoffart added bug Something isn't working priority:low Lowest priority. The issue is kept open for tracking purpose, but noone is actively working on this and removed need triaging Issue that the owner of the area still need to triage labels Nov 16, 2024
@ogoffart ogoffart changed the title Have a way to programatically force a layout of a window without needing to render it Window::size should return the preferred size before the window is shown. Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:layouts Related to the layouting and positioning of the elements (mO,bT) bug Something isn't working priority:low Lowest priority. The issue is kept open for tracking purpose, but noone is actively working on this
Projects
None yet
Development

No branches or pull requests

2 participants