1786018092
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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!"; } }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user