Qt signal/slot solution in slint/rust #3030
-
I'm currently rewriting a Qt based C++ solution in slint and rust, and as I'm relatively new to rust, I'm looking for a solution for the Qt signal/slot system. The C++ solution relies heavily on the signal/slot system, and I'm having trouble finding something equivalent in rust. My goal is to have multiple threads running and communicating with each other and the UI. For example: I'd love to hear some ideas and concepts on how to solve this problem. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I see that I similar question was asked on reddit: https://www.reddit.com/r/rust/comments/14osg13/rust_equalivalent_of_qt_signalslots/ In Rust, you'd probably use async programming with tokio in your threads. Anyway, from your thread, you would use slint::invoke_from_event_loop to run code in the UI thread (update the UI) |
Beta Was this translation helpful? Give feedback.
I see that I similar question was asked on reddit: https://www.reddit.com/r/rust/comments/14osg13/rust_equalivalent_of_qt_signalslots/
In Rust, you'd probably use async programming with tokio in your threads.
So you'd have the Slint event loop running in the main thread (the UI thread), and you would have an async executor running in the other thread (for example tokio), but it could also be some loop waiting for message or something.
Anyway, from your thread, you would use slint::invoke_from_event_loop to run code in the UI thread (update the UI)
There is an example in https://docs.rs/slint/latest/slint/fn.invoke_from_event_loop.html