Closed han1548772930 closed 6 months ago
ok , I've tried it so far but I can't confirm if it's the way it should be. But there is no such program in the tray in the lower right corner.
use std::thread;
use slint::run_event_loop_until_quit;
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);
let _ = run_event_loop_until_quit();
let _ = ui.window().hide();
thread::sleep(std::time::Duration::from_secs(3));
let _ = ui.window().show();
}
});
// let _ = std::thread::spawn(move || {
// let _ = run_event_loop_until_quit();
// });
ui.run()
}
Try
let _ = ui.show();
run_event_loop_until_quit();
instead of ui.run()
.
On windows, the program hangs directly after
hide()
. How to run in the background