Index: sources/gui/qml/components/Slider.qml =================================================================== diff -u -r28845c70151c3fb6f1a8e92c82da0232b6ca854a -r8610e83160b703fb1762bd6a50b920b39cccea68 --- sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 28845c70151c3fb6f1a8e92c82da0232b6ca854a) +++ sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 8610e83160b703fb1762bd6a50b920b39cccea68) @@ -57,6 +57,11 @@ signal handleSelected() signal sliderSelected() + QtObject { id: _private + property bool hasDefaultValue : false + property real defaultValue : _root.value + } + // 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. @@ -65,6 +70,12 @@ _progressRect.value = vValue } + function setDefaultValue(vValue) { + reset(vValue) + _private.hasDefaultValue = true + _private.defaultValue = vValue + } + function incrementValue (vInStepSegments) { updateValue(vInStepSegments, true) } @@ -111,14 +122,18 @@ onIsActiveChanged: { setActiveVisuals(isActive) + // A slider can have a default value that is used in place of the minimum in cases + // where the slider is not inactive zero or just got activated + let defaultValue = (_private.hasDefaultValue) ? _private.defaultValue : minimum + // 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 : defaultValue } else { - _root.value = _progressRect.value = minimum + _root.value = _progressRect.value = defaultValue } activeChanged() // emit