Index: sources/gui/qml/components/SliderUfAdjustment.qml =================================================================== diff -u -r4c45b0a8be6589f9fb55b646edbe075a1f7df4fd -rbdd960a9976414b7239bb753e75f878a09738718 --- sources/gui/qml/components/SliderUfAdjustment.qml (.../SliderUfAdjustment.qml) (revision 4c45b0a8be6589f9fb55b646edbe075a1f7df4fd) +++ sources/gui/qml/components/SliderUfAdjustment.qml (.../SliderUfAdjustment.qml) (revision bdd960a9976414b7239bb753e75f878a09738718) @@ -24,82 +24,27 @@ /*! * \brief Slider component with a title and the currently selected value */ -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 +Item { id: _root property alias decimal : _slider.decimal property alias minimum : _slider.minimum property alias maximum : _slider.maximum property alias minStop : _slider.minStop property alias value : _slider.value property alias defaultValue : _slider.defaultValue property alias step : _slider.step - property alias inActiveZero: _slider.inActiveZero - - property string zeroLabel : "" - property string unit : "" property bool active : false - property bool valid : true - property alias enableAdjustButtons : _sliderArrows.enabled - signal pressed () signal released() height : Variables.createTreatmentSliderHeight width : Variables.createTreatmentSliderWidth - color : Colors.transparent - 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) } - function setColor() { - let color = Colors.textMain - if ( ! _root.valid ) { color = Colors.createTreatmentInvalidParam ; return color } - if ( ! _root.active ) { color = Colors.textDisableButton ; return color } - return color - } - - function setValue() { - // The slider is not adjustable, implying it won't have a value change - if ( !adjustable && zeroLabel !== "") { - return _root.zeroLabel - } - - let mValue = "__" - let unit = " " + _root.unit - - if ( _root.active ) { - if ( _slider.value === 0 && zeroLabel !== "" ) { - return _root.zeroLabel - } - mValue = _slider.value.toFixed(decimal) - } - return mValue + unit - } - - function setInteractive( vInteractive ) { - if (_root.flickable) { - _root.flickable.interactive = vInteractive - } - } - function setActiveValid() { _root.active = true } @@ -112,7 +57,6 @@ rightMargin : 60 verticalCenter : _sliderArrows.verticalCenter } - enabled : _root.adjustable height : Variables.ultraFiltrationProgressBarHeight bgColor : Colors.ufAdjustmentProgressBarBg highlightActiveColor : Colors.ufAdjustmentDeltaFill @@ -121,15 +65,13 @@ diameter : Variables.progressbarHandler touchMargin : Variables.createTreatmentSliderMargin handler.z : 5 - handlerVisible : _root.adjustable isActive : _root.active stepSnap : true ticks : true - onDragged : { setInteractive(false) ; ; } - onPressed : { setInteractive(false) ; _root.pressed () ; } - onReleased : { setInteractive(true ) ; _root.released() ; } - onHandleSelected : { setActiveValid(); } - onSliderSelected : { setActiveValid(); } + onPressed : { _root.pressed () } + onReleased : { _root.released() } + onHandleSelected : { setActiveValid() } + onSliderSelected : { setActiveValid() } minText { font { pixelSize : Fonts.fontPixelButton @@ -180,7 +122,7 @@ value : _root.minStop handle.width : Variables.ultrafiltrationRangeMarkerHandleWidth text { - anchors.bottomMargin: marker.valueOnTop ? 15 : 0 + anchors.bottomMargin: _removedMarker.valueOnTop ? 15 : 0 font { pixelSize: Fonts.fontPixelUltrafiltrationRangeMarker weight: Font.DemiBold @@ -195,35 +137,20 @@ right : parent.right } - // 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 { + } + else { setActiveValid() - if ( inActiveZero ) { // NOTE: @inActiveZero - _slider.decrementValue() - } } } onDecrementValue : { - // do not allow slider to decrement if doing so will let it go below the minimum bound - if (_slider.minStop && (_slider.value - _slider.step) < _slider.minStop) { - return - } if ( _slider.isActive) { _slider.decrementValue(true) - } else { + } + else { setActiveValid() - if ( inActiveZero ) { // NOTE: @inActiveZero - _slider.decrementValue() - } } } }