Index: sources/gui/qml/components/Slider.qml =================================================================== diff -u -r56e378f7504701b9e9a9dccaf205aef2fd52c58e -r4fab8841b1040c8eaa406713ff9bdc8c65b7b6ac --- sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 56e378f7504701b9e9a9dccaf205aef2fd52c58e) +++ sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 4fab8841b1040c8eaa406713ff9bdc8c65b7b6ac) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file Slider.qml - * \author (last) Behrouz NemaiPour - * \date (last) 04-Jun-2020 + * \author (last) Peter Lucia + * \date (last) 15-Oct-2020 * \author (original) Behrouz NematiPour * \date (original) 18-Mar-2020 * @@ -36,7 +36,37 @@ property alias handler : _handler + property alias diameter : _handler.diameter + property alias knobColor : _handler.color + property bool isActive : false; + signal progressRectClicked() + signal progressRectDragged() + signal activeChanged() + + function setActive(active) { + if (active) { + color = Colors.createTreatmentActive + knobColor = Colors.createTreatmentActive + } else { + color = Colors.createTreatmentInactive + knobColor = Colors.createTreatmentInactive + } + + if (active !== isActive) { + isActive = active; + activeChanged() + } + } + + onIsActiveChanged: { + setActive(isActive) + if (!isActive) { + value = minimum + } + activeChanged() + } + height : Variables.progressbarHeight touchMargin : 25 @@ -76,7 +106,7 @@ value = getValueOfX(x) - if ( step === 1 ) { /* keep the value and return */ return; } + if ( step === 1 ) { value = parseInt(value); return; } var start = 0 if ( ! stepSnap ) start = minimum @@ -97,10 +127,15 @@ // propagation is not working on drag ! onDragged: { setValue(vMouseEvent.x) + progressRectDragged() } onClicked: { setValue(vMouseEvent.x) + progressRectClicked() } + onPressChanged: { + _root.pressChanged() + } } // used loader for performance since it may not always be required.