1786018092
This commit is contained in:
@@ -10,6 +10,12 @@ fn main() -> Result<(), slint::PlatformError> {
|
|||||||
|
|
||||||
let ui = AppWindow::new()?;
|
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()
|
ui.run()
|
||||||
|
|
||||||
// let red = (255, 0, 0, 255);
|
// 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 {
|
export component AppWindow inherits Window {
|
||||||
|
in-out property<int> counter: 42;
|
||||||
|
callback request-increase-value();
|
||||||
VerticalBox {
|
VerticalBox {
|
||||||
alignment: start;
|
|
||||||
Text {
|
Text {
|
||||||
text: "Hello World!";
|
text: "Counter: \{root.counter}";
|
||||||
font-size: 24px;
|
|
||||||
horizontal-alignment: center;
|
|
||||||
}
|
}
|
||||||
AboutSlint {
|
Button {
|
||||||
preferred-height: 150px;
|
text: "Increase value";
|
||||||
|
clicked => {
|
||||||
|
root.request-increase-value();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
HorizontalLayout { alignment: center; Button { text: "OK!"; } }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user