How can I control a ProgressIndicator value from Rust #8466
Unanswered
bob-anderson-ok
asked this question in
Q&A
Replies: 3 comments 1 reply
-
You can define a Then you can two-way bind this value to the progress indicator's |
Beta Was this translation helpful? Give feedback.
0 replies
-
What does the Rust side look like?
Bob
…On Mon, May 19, 2025 at 1:31 AM Tobias Hunger ***@***.***> wrote:
You can define a image-load-progress in property in your root Element (or
a global) and set this value from rust.
Then you can two-way bind this value to the progress indicator's value.
—
Reply to this email directly, view it on GitHub
<#8466 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABG6OD3WZE7A3AULKTC4NI327GJGZAVCNFSM6AAAAAB5MIT53WVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGMJZGA4DCOA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
The function that needs to update the progress indicator is defined outside
of main (of course). But ui is defined inside of main. What is a good way
to make ui visible to that external function? I am not averse to using
static and unsafe as my app is single threaded.
Bob
…On Mon, May 19, 2025 at 9:21 AM Tobias Hunger ***@***.***> wrote:
It depends on whether you define the property on the Window or a global
object:
export component MainWindow {
in-out property <int> image-load-progress-value: 0;
[...]
ProgressBar {
value <=> root.image-load-progress-value;
}
}
// create the UI:let ui = MainWindow::new()?;
[...]
ui.set_image_load_progress_value(0);
—
Reply to this email directly, view it on GitHub
<#8466 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABG6OD2HICJJZBPFGANYRB327IAG5AVCNFSM6AAAAAB5MIT53WVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGMJZGYYDMNY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have an image that I compute and display in an Slint Image widget through a pure callback called render_image(...) -> Image:
This works well as I can trigger a call to render_image with a simple refresh-image += 1 in response to widget clicks or edits.
My problem is that sometimes the image calculation can be lengthy and I want to use a ProgressIndicator to inform the user as to what's going on. But I do not know how to change a widget property (ProgressIndicator value) from the rust side outside of a callback. It seems a violation of the reactive principals that Slint is based on and that may be why I cannot find an example. I'm guessing that I somehow need to interact with the Slint event queue, but I cannot find any example that I can understand that follows this path.
I'm looking for some threads to pull on.
Beta Was this translation helpful? Give feedback.
All reactions