Index: sources/gui/qml/components/Slider.qml =================================================================== diff -u -r7ed22fc4ad6b61ea9a502f3e2eeca6d10fb0699d -r60c48d81ada63ef857cec8406d553658477ef87f --- sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 7ed22fc4ad6b61ea9a502f3e2eeca6d10fb0699d) +++ sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 60c48d81ada63ef857cec8406d553658477ef87f) @@ -55,10 +55,30 @@ property bool hasBorder : true property color borderColor : Colors.borderDisableButton + QtObject { id:_private + // To avoid displaying and updating _root.value with intermediate values, + // the _root.value aliasing to _progressRect.value is removed. Causing any setting of + // _root.value outside of slider actions (handle dragging, slider-line clicking, etc) + // to not update the _progressRect.value. This will cause the visuals to not line up + // to _root.value's current number. Adding a boolean to indicate when the _root.value + // changes is internal to avoid updating the _progressRect.value. + // This value is set primarily in the update() function and checked for in + // onValueChanged handler + property bool isInternalValueUpdate : false + } + + onValueChanged: { + // See note about _private.isInternalValueUpdated + if (! _private.isInternalValueUpdate) { + _progressRect.value = value // update the slider visual + } + } + signal activeChanged() signal handleSelected() signal sliderSelected() + function incrementValue (vInStepSegments) { updateValue(vInStepSegments, true) } @@ -112,7 +132,7 @@ // It allows correct behavior when using arrow on a first initialize increment of // the slider when the slider has inActiveZero to true. if(!isActive) { - _root.value = inActiveZero ? 0 : minimum + _root.value = inActiveZero ? 0 : minimum // Not using update() here because slider is not active => _progressRect not visible } else { _root.value = _progressRect.value = minimum } @@ -164,7 +184,14 @@ } function update(vValue) { + // See note at _private.isInternalValueUpdate + _private.isInternalValueUpdate = true + + // Update the _root.value / the exposed value of slider _root.value = vValue + + // reset state to allow _root.value value updating externally + _private.isInternalValueUpdate = false } function calculateValue(x, isSnappingToTicks) {