Index: sources/gui/qml/components/Slider.qml =================================================================== diff -u -rbd5b9fde790ce1fe678ed47f76492c78ee744c19 -rb72d5c0a794796139351ac79747e00d658bad620 --- sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision bd5b9fde790ce1fe678ed47f76492c78ee744c19) +++ sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision b72d5c0a794796139351ac79747e00d658bad620) @@ -49,9 +49,10 @@ property int tickMarksThickness : 2 - signal progressRectClicked() - signal progressRectDragged() +// signal progressRectClicked() +// signal progressRectDragged() signal activeChanged() + signal handleSelected() function setActive(active) { if (active) { @@ -74,7 +75,7 @@ onValueChanged: { if ( _root.isActive ) { // update the displayed value to the attentive snapped value - _root.displayedValue = (Math.round(_root.value / step) * step).toFixed(decimal) + _root.displayedValue = calculateRoundedValue(_root.value) } } @@ -108,6 +109,10 @@ font.bold : false } + function calculateRoundedValue(vValue){ + return (Math.round(vValue / step) * step).toFixed(decimal) + } + function getValueOfX(x) { return ( x * ( maximum - minimum ) ) / width + minimum } @@ -176,7 +181,7 @@ // propagation is not working on drag ! onDragged: { _root.dragged(vMouseEvent) - progressRectDragged() +// progressRectDragged() } onPressed: { _root.pressed(vMouseEvent) @@ -218,6 +223,7 @@ // Update the slider's value since the cursor did move update(newCurrentValue) + _progressRect.previousSliderValue = newCurrentValue } } @@ -245,8 +251,10 @@ } onReleased: { - // Need to account for the extended touch areas - updateHandleValue(vMouseEvent.x - _progressRect.leftRightTouchMargin) + if (isActive) { + // Need to account for the extended touch areas + updateHandleValue(vMouseEvent.x - _progressRect.leftRightTouchMargin) + } } Rectangle { id: _handler @@ -264,5 +272,18 @@ width: Variables.progressbarHandlerBorderWidth color: Colors.textMain } + MouseArea { + 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 + } + } } }