summaryrefslogtreecommitdiff
path: root/src/gui.rs
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-10-24 14:05:20 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-10-24 14:05:20 +0800
commit5efbb36cca0735ccdc32130d648a062c8dc59cdb (patch)
treea07e2f2475861530189a652c27174048eab85a03 /src/gui.rs
parent5bece4655dc21426e18457c2bf9799ab8994f0ce (diff)
Diffstat (limited to 'src/gui.rs')
-rw-r--r--src/gui.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gui.rs b/src/gui.rs
new file mode 100644
index 0000000..b727684
--- /dev/null
+++ b/src/gui.rs
@@ -0,0 +1,26 @@
+// Prevent console window in addition to Slint window in Windows release builds
+// when, e.g., starting the app via file manager. Ignored on other platforms.
+#![cfg_attr(
+ not(debug_assertions),
+ windows_subsystem = "windows"
+)]
+
+use std::error::Error;
+
+slint::include_modules!();
+
+fn main() -> Result<(), Box<dyn Error>> {
+ 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()?;
+
+ Ok(())
+}