Index: sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentDuration.qml =================================================================== diff -u -r56e378f7504701b9e9a9dccaf205aef2fd52c58e -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 --- sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentDuration.qml (.../TreatmentAdjustmentDuration.qml) (revision 56e378f7504701b9e9a9dccaf205aef2fd52c58e) +++ sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentDuration.qml (.../TreatmentAdjustmentDuration.qml) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) @@ -1,15 +1,15 @@ /*! * - * Copyright (c) 2019-2020 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 TreatmentAdjustmentDuration.qml - * \author (last) Behrouz NemaiPour - * \date (last) 18-Jun-2020 - * \author (original) Behrouz NematiPour - * \date (original) 27-Apr-2020 + * \file TreatmentAdjustmentDuration.qml + * \author (last) Vy + * \date (last) 11-May-2023 + * \author (original) Behrouz NematiPour + * \date (original) 27-Apr-2020 * */ @@ -29,7 +29,7 @@ TreatmentAdjustmentBase { id: _root contentItem.objectName: "TreatmentAdjustmentDuration" //SquishQt testability - /* -- */ property alias durationValue : _durationSlider.value + readonly property real durationValue : _durationSlider.value readonly property alias durationMinimum : _durationSlider.minimum readonly property alias durationMaximum : _durationSlider.maximum readonly property alias durationStep : _durationSlider.step @@ -39,28 +39,45 @@ property int textWidth : 200 + // Due to how the slider is set up, a setter function is needed to set the slider value + function setDurationValue(value) { + _durationSlider.reset(value) + } + titleText: qsTr("TREATMENT DURATION") - Column { id : _column - spacing: 65 + Item { id : _container + readonly property int sideMarginSize: Variables.headerButtonsMargin + Variables.confirmButtonWidth/2 - _durationSliderArrows.width/2 // Centers on the confirmButton + width : _root.width + height : 200 anchors.centerIn: parent + TimeText { id: _currentTimeText seconds: vTreatmentTime.time_Elapsed secondsVisible: true textPixelSize: Fonts.fontPixelDurationCurTime anchors.horizontalCenter: parent.horizontalCenter + anchors.top: _container.top + anchors.bottom: _durationSlider.top + anchors.bottomMargin: 65 } Slider { id : _durationSlider - anchors.horizontalCenter: parent.horizontalCenter - width : 880 - height : 5 + // The distance from parent's right side to the rightmost of slider - with slider arrows and spacings considered + readonly property int sliderAndArrowSpacing : Variables.sliderAdjustButtonSpacing + _durationSlider.handler.width/2 + readonly property int distanceFromSide : _durationSlider.sliderAndArrowSpacing + _durationSliderArrows.width + _container.sideMarginSize + width : _container.width - (distanceFromSide * 2) // determine the size of slider to center minimum : vTreatmentRanges.treatmentRanges_Duration_Min // in Minutes maximum : vTreatmentRanges.treatmentRanges_Duration_Max // in Minutes step : Variables.durationResolution - stepSnap: true - minText.visible: false - maxText.visible: false - ticks: true + stepSnap : true + minText.visible : false + maxText.visible : false + ticks : true + + anchors.right : _durationSliderArrows.left + anchors.rightMargin : _durationSlider.sliderAndArrowSpacing + anchors.bottom : _container.bottom + TimeText { id: _durationText seconds: 60 * _durationSlider.value // in Minutes => to Seconds secondsVisible: false @@ -73,5 +90,15 @@ } } } + SliderArrows{ id: _durationSliderArrows + visible : true + anchors.verticalCenter : _durationSlider.verticalCenter + anchors.right : _container.right + anchors.rightMargin : _container.sideMarginSize + + onIncrementValue : _durationSlider.incrementValue(true) + onDecrementValue : _durationSlider.decrementValue(true) + } } + }