slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.7k stars 614 forks source link

Implement a way so a slint Window can programmatically be switched to fullscreen-mode. #6665

Open bennysj opened 1 month ago

bennysj commented 1 month ago

Implement a way so a slint Window can programmatically be switched to fullscreen-mode. Ideally this can just be a in-out property on the Window item.

Example:

export component AppTestWindow inherits Window {
    width: 600px;
    height: 500px;
    full-screen: true; // in-out parameter that can possibly be connected to Switch setting or anything else
}
tronical commented 1 month ago

Are you looking for https://docs.rs/slint/latest/slint/struct.Window.html#method.set_fullscreen perhaps?

bennysj commented 1 month ago

Yes and no, I want an easy way to toggle full-screen mode from the slint code

tronical commented 1 month ago

I'd say that this is close to "business logic", not sure if intrinsic to the design. Why not define a callback that you can implement and the toggle as needed?

bennysj commented 1 month ago

I understand your point. Yes the callback would also work. I just think it's so much easier to implement the UI-logic if this is exposed in Window component, and just like 'width' 'height' 'visible' etc properties, it makes sense to also have 'full-screen' for the Window component.