There is a self contained example of the problem:
Rectangle {
id: rect
width: 200
height: 200
property real v : 50
onVChanged: console.log(v)
Button {
onClicked: scomp.createObject(rect)
}
Component {
id: scomp
Rectangle {
id: sli
anchors.fill: parent
Column {
Slider {
width: 200
minimumValue: 10
maximumValue: 100
value: rect.v
onValueChanged: rect.v = value
}
Button {
onClicked: sli.destroy()
}
}
}
}
}
Basically, every time the slider component is created to modify v
it sets it to the slider's minimum value. Note that the slider will still work correctly to modify that value, and v
will retain its proper value after the slider is closed, but the moment it is opened again, the value corrupts again.
Why is this happening, how to prevent it? It would seem that for some explainable reason, the slider's value
property temporarily assumes its minimumValue
value, but that doesn't look like adequate behaviour. Maybe a bug? The slider never really assumes the correct initial value, even if value: rect.v
is moved before setting the minimum value.