Index: sources/gui/qml/components/SliderCreateTreatment.qml =================================================================== diff -u -r6179111114213085810211b7311c033605c9d448 -r83b9d737cd495b34a7b42f5409962a9442f3b8f4 --- sources/gui/qml/components/SliderCreateTreatment.qml (.../SliderCreateTreatment.qml) (revision 6179111114213085810211b7311c033605c9d448) +++ 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) 11-Apr-2023 + * \date (last) 26-Jan-2024 * \author (original) Peter Lucia * \date (original) 07-Jul-2020 * @@ -27,6 +27,8 @@ 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 @@ -54,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) } @@ -135,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() + } } } }