[Interest] How to set QtQuickControls Slider to an initial value without modifying the current saved?
Nuno Santos
nunosantos at imaginando.pt
Thu Oct 16 17:39:31 CEST 2014
Hi,
I’m using Slider from QtQuickControls and i’m facing a problem. I initialise the value with a value saved on settings. However, when the slider is instantiated, it is triggering onValueChanged with the default min value. The setting is being correctly saved because I don’t show the slider right away. Only when the slider is show, this is happening and I see the result of the change in settings.
Slider {
width: parent.width
height: 10
minimumValue: 60
maximumValue: 180
stepSize: 1
updateValueWhileDragging: true
value: settings.trackWidth
onValueChanged: {
console.log("track width value changed: " + value)
settings.trackWidth = value
}
Component.onCompleted: {
console.log("track width on completed: " + settings.trackWidth)
value = settings.trackWidth
}
}
Console:
qml: track width value changed: 60
qml: track width on completed: 60
Any ideas?
Regards,
Nuno
More information about the Interest
mailing list