Index: sources/gui/qml/components/Slider.qml =================================================================== diff -u -r7578800a0b1b509e855e5e872798163b2b2e4b1e -r376fa09daeeca0afef2b157005cc85e9595c4c96 --- sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 7578800a0b1b509e855e5e872798163b2b2e4b1e) +++ sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 376fa09daeeca0afef2b157005cc85e9595c4c96) @@ -26,6 +26,7 @@ RangeRect { id: _root property alias value : _progressRect.value property real displayedValue : 0 + property real initActiveValue : _root.minimum // the value to assigned upon first activation property real step : 1 property bool stepSnap : false @@ -58,18 +59,10 @@ signal handleSelected() function incrementValue (vInStepSegments) { - // in case the slider is not yet activated, activate - if (!isActive) { - setActive(true) - } updateValue(vInStepSegments, true) } function decrementValue (vInStepSegments) { - // in case the slider is not yet activated, activate - if (!isActive) { - setActive(true) - } updateValue(vInStepSegments, false) } @@ -94,7 +87,7 @@ update(newValue.toFixed(decimal)) } - function setActive(active) { + function setActiveVisuals(active) { if (active) { color = Colors.sliderHighlightColor handlerColor = Colors.createTreatmentActive @@ -105,11 +98,19 @@ } onIsActiveChanged: { - setActive(isActive) + setActiveVisuals(isActive) + + // value is assigned a different value based on active-ness of the slider + // This is to resolve the use of slider with a switch and arrows enabled. + // It allows correct behavior when using arrow on a first initialize increment of + // the slider when the slider has inActiveZero to true. if (!isActive) { value = inActiveZero ? 0 : minimum + } else { + value = initActiveValue } - activeChanged() + + activeChanged() // emit } onValueChanged: { @@ -126,7 +127,7 @@ radius : _root.isRoundedEnds ? (height/2) : Variables.rangeRectRadius border.width: _root.hasBorder ? Variables.rangeRectBorderWidth : 0 - border.color: _root.isActive ? Colors.borderButton : Colors.borderDisableButton + border.color: _root.isActive ? Colors.borderButton : Colors.borderDisableButton minimum : 0 maximum : 0