commit
d0cbde9442
@ -0,0 +1,6 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"rust-lang.rust-analyzer",
|
||||
"vadimcn.vscode-lldb",
|
||||
"Slint.slint"
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "sciencecalc"
|
||||
version = "0.1.0"
|
||||
authors = ["Lukas Martin"]
|
||||
edition = "2021"
|
||||
build = "build.rs"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
slint = "1.6"
|
||||
|
||||
[build-dependencies]
|
||||
slint-build = "1.6"
|
||||
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
slint_build::compile("ui/appwindow.slint").unwrap();
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
slint::include_modules!();
|
||||
|
||||
fn main() -> Result<(), slint::PlatformError> {
|
||||
let ui = AppWindow::new()?;
|
||||
|
||||
ui.on_request_increase_value({
|
||||
let ui_handle = ui.as_weak();
|
||||
move || {
|
||||
let ui = ui_handle.unwrap();
|
||||
ui.set_counter(ui.get_counter() + 1);
|
||||
}
|
||||
});
|
||||
|
||||
ui.run()
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
import { Button, VerticalBox } from "std-widgets.slint";
|
||||
|
||||
export component AppWindow inherits Window {
|
||||
in-out property <int> counter: 42;
|
||||
callback request-increase-value();
|
||||
VerticalBox {
|
||||
Text {
|
||||
text: "Counter: \{root.counter}";
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Increase value";
|
||||
clicked => {
|
||||
root.request-increase-value();
|
||||
}
|
||||
height: 35px;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue