Closed nununoisy closed 5 months ago
I have a fix for this issue but from my perspective it make sense to merge #3096 first.
PR #3101 should fixes the issue for material
and fluent
SpinBox
. For the native
SpinBox
more work needs to been done, because it lacks an TextInput
element in the moment. That will be done next.
I still can reproduce problem with fluent spinbox - code
https://github.com/slint-ui/slint/assets/41945903/bcfe5f2e-db4c-43f6-b4e4-627c95d8225e
needs #112
Is there any workaround for forcing an update on the UI until #112 is implemented? I would like to have a "Reset" button for a SpinBox, but the number in the SpinBox is not updated.
When binding a
SpinBox
'svalue
to a property, then updating the property from outside of theSpinBox
, the internalTextInput
'svalue
is not updated in certain circumstances. I've experimented with the issue a bunch and I believe that the issue manifests when the value is updated from within theSpinBox
, though I'm unsure if there are any other triggers.Here are the steps I've found to reproduce the issue (you can follow along with this SlintPad MRE):
SpinBox
with a binding to an integer property and some way for that property to be updated, either from another component or from native code.SpinBox
, either by editing the text input or by clicking one of the stepper buttons.SpinBox
acts as though its value is what it had been externally updated to. This shows that the value within theSpinBox
is indeed changing, but theTextInput
is not receiving the new value.I can reproduce this on the Qt backend (Qt 6, rust MSVC 1.70 stable, Windows 10 22H2 & Qt 5, rust GNU 1.70 stable, Debian 11 on WSL2) and the web backend (SlintPad).
Looking through the implementation for the Fluent-styled
SpinBox
, it seems that the issue stems from the way that theTextInput
'stext
prop is updated. Whenever the value is updated from within theSpinBox
,update-text()
is called to update theTextInput
to match. However, when this is done, it seems as though some link betweenroot.value
andi-text-input.text
is removed; perhapsi-text-input.text
is set to a constant equivalent to whateverroot.value
was at the time?I unfortunately don't know enough about Slint to suggest a good fix for this. My instinct would be to publicize the
update-value(int)
function but it would be rather weird for one singular standard component to require value updates to be performed through a function.