Index: sources/gui/qml/components/Slider.qml =================================================================== diff -u -r3bf1c89cba7851e7658d4a7f2e7054ee6a4ff000 -r18c39727da06312b90d15751e6a27e03c7b6742a --- sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 3bf1c89cba7851e7658d4a7f2e7054ee6a4ff000) +++ sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 18c39727da06312b90d15751e6a27e03c7b6742a) @@ -24,9 +24,7 @@ * \brief Denali project ProgressBar */ RangeRect { id: _root - property alias value : _progressRect.value - property real displayedValue : 0 - property real initActiveValue : _root.minimum // the value to assigned upon first activation + property real value : _progressRect.value property real step : 1 property bool stepSnap : false @@ -75,17 +73,21 @@ let newValue = Number.NaN if(vIsIncrement) { - newValue = _root.value + amountChanged + newValue = _progressRect.value + amountChanged } else { - newValue = _root.value - amountChanged + newValue = _progressRect.value - amountChanged } // Capping values based on min/max threshold if ( newValue < minimum ) newValue = minimum if ( newValue > maximum ) newValue = maximum - // update new value - update(newValue.toFixed(decimal)) + // Update the slider's visual value + _private.previousSliderValue = newValue // for comparison purposes + _progressRect.value = newValue // visual value + + // update slider value with rounded new value + update(newValue) } function setActiveVisuals(active) { @@ -98,6 +100,8 @@ } } + onEnabledChanged: _progressRect.value = minimum // reset the visual progress bar + onIsActiveChanged: { setActiveVisuals(isActive) @@ -106,21 +110,14 @@ // It allows correct behavior when using arrow on a first initialize increment of // the slider when the slider has inActiveZero to true. if(!isActive) { - value = inActiveZero ? 0 : minimum + _root.value = inActiveZero ? 0 : minimum } else { - value = initActiveValue + _root.value = _progressRect.value = minimum } activeChanged() // emit } - onValueChanged: { - if ( _root.isActive ) { - // update the displayed value to the attentive snapped value - _root.displayedValue = calculateRoundedValue(_root.value) - } - } - height : Variables.sliderDefaultBodyHeight touchMargin : 25 leftRightTouchMargin: _handler.width/2 @@ -238,9 +235,10 @@ ProgressRect { id: _progressRect property real previousSliderValue: Number.NaN - value : (inActiveZero && (!isActive)) ? 0 : initActiveValue + value : minimum color : Colors.sliderHighlightColor decimal : _root.decimal + minimum : _root.minimum maximum : _root.maximum leftRightTouchMargin: _handler.width/2 @@ -269,16 +267,21 @@ // Check the cursor's current value to determine if the cursor had moved // Do not avoid type coercion, it will produce undesired results - if(newCurrentValue != _progressRect.previousSliderValue) { - // The cursor did move + if(newCurrentValue != _private.previousSliderValue) { + + // The cursor did move if(stepSnapOnRelease) { // check for snapping state to save an iteration of recalculation if snap is off newCurrentValue = calculateValue(vCurrentPositionX, stepSnapOnRelease) } // Update the slider's value since the cursor did move - update(newCurrentValue) - _progressRect.previousSliderValue = newCurrentValue + _private.previousSliderValue = newCurrentValue // for comparison purposes + _progressRect.value = newCurrentValue // visual value + + // update slider value with rounded new value + update(calculateRoundedValue(newCurrentValue)) + } } @@ -287,21 +290,16 @@ // Need to account for the extended touch areas let adjustedXPosition = vMouseEvent.x - _progressRect.leftRightTouchMargin let newCurrentValue = calculateValue(adjustedXPosition, !stepSnapOnRelease) - update(newCurrentValue) + _progressRect.value = newCurrentValue // update visual active slider bar + + update(calculateRoundedValue(newCurrentValue)) // displayed/slider value } + onPressed: { // Indicate that the slider body was selected to provide handling/activation sliderSelected() // emit - // On a pressed action, if the snapped version of the new value is the same as the - // current snapped value, do nothing; otherwise update the value to stay under - // the cursor until a release action happens to update to new snapped value - let adjustedXPosition = vMouseEvent.x - _progressRect.leftRightTouchMargin - let newCurrentValue = calculateValue(adjustedXPosition, !stepSnapOnRelease) - let roundedNewNumber = calculateRoundedValue(newCurrentValue) - if(roundedNewNumber != _progressRect.value){ - update(newCurrentValue) - } + updateHandleValue(vMouseEvent.x - _progressRect.leftRightTouchMargin) } onReleased: { // Need to account for the extended touch areas @@ -327,11 +325,6 @@ anchors.fill: parent propagateComposedEvents: true onPressed: { - // Handle was inactive and was selected, update the value - if ( !_root.isActive ) { - value = inActiveZero ? 0 : minimum - _root.displayedValue = calculateRoundedValue(value) - } mouse.accepted = false // allow propagtion to the lower mouse areas handleSelected() // emit } Index: sources/gui/qml/components/SliderCreateTreatment.qml =================================================================== diff -u -rca4e934c2a8398b5555f86cce83e7704e47798eb -r18c39727da06312b90d15751e6a27e03c7b6742a --- sources/gui/qml/components/SliderCreateTreatment.qml (.../SliderCreateTreatment.qml) (revision ca4e934c2a8398b5555f86cce83e7704e47798eb) +++ sources/gui/qml/components/SliderCreateTreatment.qml (.../SliderCreateTreatment.qml) (revision 18c39727da06312b90d15751e6a27e03c7b6742a) @@ -43,11 +43,9 @@ property bool valid : true property alias enableAdjustButtons : _sliderArrows.enabled - property bool isUsingDisplayValue : true // indicate whether using the slider's actual value or displayedValue signal pressed () signal released() - signal valueUpdateComplete() height : Variables.createTreatmentSliderHeight width : Variables.createTreatmentSliderWidth @@ -70,7 +68,6 @@ function setValue() { // The slider is not adjustable, implying it won't have a value change - // set the zeroLabel if ( !adjustable && zeroLabel !== "") { return _root.zeroLabel } @@ -82,7 +79,7 @@ if ( _slider.value === 0 && zeroLabel !== "" ) { return _root.zeroLabel } - mValue = isUsingDisplayValue ? _slider.displayedValue.toFixed(decimal) : _slider.value + mValue = _slider.value.toFixed(decimal) } return mValue + unit } @@ -140,14 +137,18 @@ anchors.leftMargin : Variables.sliderAdjustButtonLeftMargin onIncrementValue : { - setActiveValid() - _slider.incrementValue(true) - valueUpdateComplete() // emit + if ( _slider.isActive) { + _slider.incrementValue(true) + } else { + setActiveValid() + } } onDecrementValue : { - setActiveValid() - _slider.decrementValue(true) - valueUpdateComplete() // emit + if ( _slider.isActive) { + _slider.decrementValue(true) + } else { + setActiveValid() + } } } Index: sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml =================================================================== diff -u -ra69a9ed9ddeca277545060abfaaed4c0c88ee208 -r18c39727da06312b90d15751e6a27e03c7b6742a --- sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml (.../PreTreatmentCreate.qml) (revision a69a9ed9ddeca277545060abfaaed4c0c88ee208) +++ sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml (.../PreTreatmentCreate.qml) (revision 18c39727da06312b90d15751e6a27e03c7b6742a) @@ -98,9 +98,7 @@ maximum : vTreatmentRanges.bloodFlowRateMax step : vTreatmentRanges.bloodFlowRateRes value : vTreatmentRanges.bloodFlowRateDef - onPressed : vTreatmentCreate.bloodFlowRate = value - onReleased : vTreatmentCreate.bloodFlowRate = value - onValueUpdateComplete: vTreatmentCreate.bloodFlowRate = value + onValueChanged: vTreatmentCreate.bloodFlowRate = value } SliderCreateTreatment { id: _dialysateFlowRate @@ -112,9 +110,7 @@ maximum : vTreatmentRanges.dialysateFlowRateMax step : vTreatmentRanges.dialysateFlowRateRes value : vTreatmentRanges.dialysateFlowRateDef - onPressed : vTreatmentCreate.dialysateFlowRate = value - onReleased : vTreatmentCreate.dialysateFlowRate = value - onValueUpdateComplete: vTreatmentCreate.dialysateFlowRate = value + onValueChanged : vTreatmentCreate.dialysateFlowRate = value } SliderCreateTreatment { id: _duration @@ -126,9 +122,7 @@ maximum : vTreatmentRanges.treatmentDurationMax step : vTreatmentRanges.treatmentDurationRes value : vTreatmentRanges.treatmentDurationDef - onPressed : vTreatmentCreate.treatmentDuration = value - onReleased : vTreatmentCreate.treatmentDuration = value - onValueUpdateComplete: vTreatmentCreate.treatmentDuration = value + onValueChanged: vTreatmentCreate.treatmentDuration = value; } Connections { target : _heparinDispensingRateSwitch @@ -172,11 +166,9 @@ maximum : vTreatmentRanges.heparinDispensingRateMax step : vTreatmentRanges.heparinDispensingRateRes value : vTreatmentRanges.heparinDispensingRateDef - onPressed : vTreatmentCreate.heparinDispensingRate = value - onReleased : vTreatmentCreate.heparinDispensingRate = value - onValueUpdateComplete: vTreatmentCreate.heparinDispensingRate = value - adjustable : _heparinDispensingRateSwitch.checked - inActiveZero: true + onValueChanged : vTreatmentCreate.heparinDispensingRate = value + adjustable : _heparinDispensingRateSwitch.checked + inActiveZero : true enableAdjustButtons: _heparinDispensingRateSwitch.checked // ToDo: create a component for Switch, @@ -245,11 +237,9 @@ maximum : vTreatmentRanges.heparinBolusVolumeMax step : vTreatmentRanges.heparinBolusVolumeRes value : vTreatmentRanges.heparinBolusVolumeDef - onPressed : vTreatmentCreate.heparinBolusVolume = value - onReleased : vTreatmentCreate.heparinBolusVolume = value - onValueUpdateComplete: vTreatmentCreate.heparinBolusVolume = value - adjustable : _heparinBolusVolumeSwitch.checked - inActiveZero: true + onValueChanged : vTreatmentCreate.heparinBolusVolume = value + adjustable : _heparinBolusVolumeSwitch.checked + inActiveZero : true enableAdjustButtons: _heparinBolusVolumeSwitch.checked // ToDo: create a component for this, @@ -316,10 +306,8 @@ maximum : vTreatmentRanges.heparinStopTimeMax step : vTreatmentRanges.heparinStopTimeRes value : vTreatmentRanges.heparinStopTimeDef - onPressed : vTreatmentCreate.heparinStopTime = value - onReleased : vTreatmentCreate.heparinStopTime = value - onValueUpdateComplete: vTreatmentCreate.heparinStopTime = value - enabled : false // this switch depends on the heparin dispencing + onValueChanged : vTreatmentCreate.heparinStopTime = value + enabled : false // this switch depends on the heparin dispencing enableAdjustButtons: _heparinDispensingRateSwitch.checked } @@ -332,9 +320,7 @@ maximum : vTreatmentRanges.salineBolusVolumeMax step : vTreatmentRanges.salineBolusVolumeRes value : vTreatmentRanges.salineBolusVolumeDef - onPressed : vTreatmentCreate.salineBolusVolume = value - onReleased : vTreatmentCreate.salineBolusVolume = value - onValueUpdateComplete: vTreatmentCreate.salineBolusVolume = value + onValueChanged : vTreatmentCreate.salineBolusVolume = value } Text { id: _titleTextOperation @@ -385,9 +371,7 @@ maximum : vTreatmentRanges.dialysateTempMax step : vTreatmentRanges.dialysateTempRes value : vTreatmentRanges.dialysateTempDef - onPressed : vTreatmentCreate.dialysateTemp = value - onReleased : vTreatmentCreate.dialysateTemp = value - onValueUpdateComplete: vTreatmentCreate.dialysateTemp = value + onValueChanged : vTreatmentCreate.dialysateTemp = value } // TODO : This has to be a Component @@ -606,9 +590,7 @@ maximum : vTreatmentRanges.bloodPressureMeasureIntervalMax step : vTreatmentRanges.bloodPressureMeasureIntervalRes value : vTreatmentRanges.bloodPressureMeasureIntervalDef - onPressed : vTreatmentCreate.bloodPressureMeasureInterval = value - onReleased : vTreatmentCreate.bloodPressureMeasureInterval = value - onValueUpdateComplete: vTreatmentCreate.bloodPressureMeasureInterval = value + onValueChanged: vTreatmentCreate.bloodPressureMeasureInterval = value adjustable : _bloodPressureIntervalSwitch.checked inActiveZero: true enableAdjustButtons: _bloodPressureIntervalSwitch.checked @@ -678,9 +660,7 @@ maximum : vTreatmentRanges.rinsebackFlowRateMax step : vTreatmentRanges.rinsebackFlowRateRes value : vTreatmentRanges.rinsebackFlowRateDef - onPressed : vTreatmentCreate.rinsebackFlowRate = value - onReleased : vTreatmentCreate.rinsebackFlowRate = value - onValueUpdateComplete: vTreatmentCreate.rinsebackFlowRate = value + onValueChanged : vTreatmentCreate.rinsebackFlowRate = value } Item { width : 50 Index: sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentFlow.qml =================================================================== diff -u -r9ac163d4aeadc39a1bcd1d8110991f32e37fc806 -r18c39727da06312b90d15751e6a27e03c7b6742a --- sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentFlow.qml (.../TreatmentAdjustmentFlow.qml) (revision 9ac163d4aeadc39a1bcd1d8110991f32e37fc806) +++ sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentFlow.qml (.../TreatmentAdjustmentFlow.qml) (revision 18c39727da06312b90d15751e6a27e03c7b6742a) @@ -89,7 +89,7 @@ anchors.topMargin: 25 width: textWidth title: qsTr("Blood Flow Rate") - label: _bloodFlowSlider.displayedValue + label: _bloodFlowSlider.value extra: Variables.unitTextFlowRate labelFont.weight: Font.ExtraLight } @@ -102,7 +102,6 @@ unit : Variables.unitTextFlowRate step : Variables.bloodFlowResolution ticks : true - isActive: false } SliderArrows{ id:_bloodFlowSliderArrows anchors.verticalCenter : _bloodFlowSlider.verticalCenter @@ -123,7 +122,7 @@ anchors.topMargin: 25 width: textWidth title: qsTr("Dialysate Flow Rate") - label: _dialysateFlowSlider.displayedValue + label: _dialysateFlowSlider.value extra: Variables.unitTextFlowRate labelFont.weight: Font.ExtraLight } @@ -135,7 +134,6 @@ unit : Variables.unitTextFlowRate step : Variables.dialysateFlowResolution ticks : true - isActive: false } SliderArrows{ id:_dialysateFlowSliderArrows anchors.verticalCenter : _dialysateFlowSlider.verticalCenter