Index: sources/gui/qml/components/Slider.qml =================================================================== diff -u -r28845c70151c3fb6f1a8e92c82da0232b6ca854a -r6179111114213085810211b7311c033605c9d448 --- sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 28845c70151c3fb6f1a8e92c82da0232b6ca854a) +++ sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 6179111114213085810211b7311c033605c9d448) @@ -25,6 +25,7 @@ */ RangeRect { id: _root property real value : _progressRect.value + property real defaultValue : _root.minimum property real step : 1 property bool stepSnap : false @@ -57,6 +58,8 @@ signal handleSelected() signal sliderSelected() + onDefaultValueChanged: refreshValue() + // this function shall be used in case that any external value is forced to be set for the slider // like the OFF switch wants to externally set the slider value and bypass slider controlls and checks. // same is used in the main treatment Blood,dialyzer sliders to be set to the current value when get in to adjustment screen. @@ -108,19 +111,29 @@ } } - onIsActiveChanged: { - setActiveVisuals(isActive) - + /* + refreshValue() re-evaluates the _root.value and _progressRect.value based on the + current active state. This function is used when the defaultValue property or + isActive property changes. + */ + function refreshValue() { // 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) { - _root.value = inActiveZero ? 0 : minimum + _root.value = inActiveZero ? 0 : _root.defaultValue } else { - _root.value = _progressRect.value = minimum + _root.value = _root.defaultValue } + // need to set the value of progressRect to reflect handle position + _progressRect.value = _root.defaultValue + } + + onIsActiveChanged: { + setActiveVisuals(isActive) + refreshValue () // re-evaluate values activeChanged() // emit }