slint
slint copied to clipboard
Windows::set_minimized(true) works only no-frame is false on macOS
- Platform: macOS 14.3.1
- Language: Rust
- Slint: master
- Backend: winit
- example
import { VerticalBox } from "std-widgets.slint";
export component Application inherits Window {
no-frame: true;
preferred-width: 400px;
preferred-height: 300px;
callback minimize-window();
callback maximize-window();
VerticalBox {
Text {
text: "minimize";
vertical-alignment: center;
horizontal-alignment: center;
height: 50px;
TouchArea {
clicked => {
if (self.pressed && self.enabled) {
root.minimize-window();
}
}
}
}
Text {
text: "maximize";
vertical-alignment: center;
horizontal-alignment: center;
height: 50px;
TouchArea {
clicked => {
if (self.pressed && self.enabled) {
root.maximize-window();
}
}
}
}
}
}
use slint::ComponentHandle;
pub mod appwin {
include!(env!("SLINT_INCLUDE_APP"));
}
fn main() {
let app = appwin::Application::new().unwrap();
let min_handle = app.as_weak();
let max_handle = app.as_weak();
app.on_minimize_window(move || {
println!("on_minimize_window");
let handle = min_handle.upgrade().unwrap();
handle.window().set_minimized(true);
});
app.on_maximize_window(move || {
println!("on_maximize_window");
let handle = max_handle.upgrade().unwrap();
handle.window().set_maximized(true);
});
app.run();
}
I can reproduce this. It works with the Qt backend, but not with the winit backend.
winit issues #3537