-
In GTK I used glib message sender/receiver
that allowed to send and receive messages with data, that computing even several seconds to main thread where gtk could update ui. In slint I don't see similar construction. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think the most common approach right now is to take a Weak handle of your app, send it across through your thread(s) and when you're ready to make changes to the UI do it through a closure invoked in the event loop with the weak handle: https://slint.dev/releases/1.2.2/docs/rust/slint/struct.Weak#method.upgrade_in_event_loop Another option would be to use an async runtime and an async enabled channel, where in a future you continuously read from the channel and you poll that future from the UI thread: https://slint.dev/releases/1.2.2/docs/rust/slint/fn.spawn_local (we don't have a good example of that yet) |
Beta Was this translation helpful? Give feedback.
I think the most common approach right now is to take a Weak handle of your app, send it across through your thread(s) and when you're ready to make changes to the UI do it through a closure invoked in the event loop with the weak handle: https://slint.dev/releases/1.2.2/docs/rust/slint/struct.Weak#method.upgrade_in_event_loop
Another option would be to use an async runtime and an async enabled channel, where in a future you continuously read from the channel and you poll that future from the UI thread: https://slint.dev/releases/1.2.2/docs/rust/slint/fn.spawn_local (we don't have a good example of that yet)