Index: sources/gui/qml/components/SliderCreateTreatment.qml =================================================================== diff -u -r00ed70b03062c6f4fa1bfd2e515efd777e086f85 -r83b9d737cd495b34a7b42f5409962a9442f3b8f4 --- sources/gui/qml/components/SliderCreateTreatment.qml (.../SliderCreateTreatment.qml) (revision 00ed70b03062c6f4fa1bfd2e515efd777e086f85) +++ sources/gui/qml/components/SliderCreateTreatment.qml (.../SliderCreateTreatment.qml) (revision 83b9d737cd495b34a7b42f5409962a9442f3b8f4) @@ -1,13 +1,13 @@ /*! * - * Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. + * Copyright (c) 2020-2024 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file SliderCreateTreatment.qml * \author (last) Behrouz NematiPour - * \date (last) 31-Mar-2023 + * \date (last) 26-Jan-2024 * \author (original) Peter Lucia * \date (original) 07-Jul-2020 * @@ -27,12 +27,15 @@ Rectangle { id: _root property Flickable flickable: null + property var toggleSwich : null // it is the treatment slider custom Switch bu it will be defined outside of this component and the var type would suffice. + property bool adjustable : true property alias label : _label.text property alias decimal : _slider.decimal property alias minimum : _slider.minimum property alias maximum : _slider.maximum property alias value : _slider.value + property alias defaultValue : _slider.defaultValue property alias step : _slider.step property alias inActiveZero: _slider.inActiveZero @@ -53,6 +56,15 @@ anchors.horizontalCenter: parent.horizontalCenter + function clear() { + reset(defaultValue) + if ( toggleSwich ) { + toggleSwich.checked = false + toggleSwich.active = false + } + _root.active = false + } + function reset(vValue) { _slider.reset(vValue) } @@ -134,18 +146,31 @@ anchors.left : _slider.right anchors.leftMargin : Variables.sliderAdjustButtonLeftMargin + // NOTE: @inActiveZero + // the slider which use inActiveZero are the once, with OFF button. + // these sliders have 0 as defalut to indicate OFF. + // when activated the first value they get is still the 0 ( OFF ). + // in that case we decrement once to get the correct minimum value. + // as example heparin dispensing after gets ON, firsrt decrement shows OFF ( 0 ). + // NOTE: if 0=defaultValue is in range (minimum < defaultValue < maximum), we still have problem, and needs more investigation onIncrementValue : { if ( _slider.isActive) { _slider.incrementValue(true) } else { setActiveValid() + if ( inActiveZero ) { // NOTE: @inActiveZero + _slider.decrementValue() + } } } onDecrementValue : { if ( _slider.isActive) { _slider.decrementValue(true) } else { setActiveValid() + if ( inActiveZero ) { // NOTE: @inActiveZero + _slider.decrementValue() + } } } }