1786018092

This commit is contained in:
2026-08-06 14:08:12 +02:00
parent 6607d8dea4
commit 275be7f3f8
2 changed files with 15 additions and 8 deletions

View File

@@ -10,6 +10,12 @@ fn main() -> Result<(), slint::PlatformError> {
let ui = AppWindow::new()?;
let ui_handle = ui.as_weak();
ui.on_request_increase_value(move || {
let ui = ui_handle.unwrap();
ui.set_counter(ui.get_counter() + 1);
});
ui.run()
// let red = (255, 0, 0, 255);

View File

@@ -1,16 +1,17 @@
import { AboutSlint, Button, VerticalBox } from "std-widgets.slint";
import { Button, VerticalBox } from "std-widgets.slint";
export component AppWindow inherits Window {
in-out property<int> counter: 42;
callback request-increase-value();
VerticalBox {
alignment: start;
Text {
text: "Hello World!";
font-size: 24px;
horizontal-alignment: center;
text: "Counter: \{root.counter}";
}
AboutSlint {
preferred-height: 150px;
Button {
text: "Increase value";
clicked => {
root.request-increase-value();
}
}
HorizontalLayout { alignment: center; Button { text: "OK!"; } }
}
}