Index: sources/gui/qml/components/Slider.qml =================================================================== diff -u -r798ce1a491cd43a3a24fb96f930d4c316add1ff1 -r7ed22fc4ad6b61ea9a502f3e2eeca6d10fb0699d --- sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 798ce1a491cd43a3a24fb96f930d4c316add1ff1) +++ sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 7ed22fc4ad6b61ea9a502f3e2eeca6d10fb0699d) @@ -47,7 +47,9 @@ property alias progressRectMargin : _progressRect.margin - property int tickMarksThickness : 2 + property int tickMarksThickness : 2 + property bool isTickMarksCentered : false ///< Indicate whether the tickmarks are centered in the slider body + property int tickMarkYDisplacement : (-_handler.height/2 - _handler.border.width*2) ///< The amount of y displacement if the TickMarks are not centered property bool isRoundedEnds : true property bool hasBorder : true @@ -213,26 +215,6 @@ return mValue; } - // used loader for performance since it may not always be required. - // and can be a heavy Component - Loader { id: _ticksLoader - active : ticks - anchors.fill : parent - sourceComponent : TickMarks { - decimal : _root.decimal - minimum : _root.minimum - maximum : _root.maximum - step : _root.step - stepSnap : _root.stepSnap - textColor : _root.color - lineTickMarkHeight : _progressRect.height - lineTickMarkThickness : _root.tickMarksThickness - isTickMarkRound : _root.isRoundedEnds - yDisplacement : _root.isRoundedEnds ? (-_handler.height/2 - _handler.border.width/2) : 0 - color : _root.isActive ? Colors.borderButton : Colors.borderDisableButton - } - } - ProgressRect { id: _progressRect property real previousSliderValue: Number.NaN value : _root.value @@ -260,6 +242,35 @@ } } + // used loader for performance since it may not always be required. + // and can be a heavy Component + Loader { id: _ticksLoader + active : ticks + width : _root.width + height : (_progressRect.height - Variables.sliderDefaultRoundTickMarkDiameter) + anchors.bottom : _root.bottom + sourceComponent : TickMarks { + decimal : _root.decimal + minimum : _root.minimum + maximum : _root.maximum + step : _root.step + stepSnap : _root.stepSnap + textColor : _root.color + lineTickMarkHeight : _progressRect.height + lineTickMarkThickness : _root.tickMarksThickness + isTickMarkRound : _root.isRoundedEnds + showEndMarks : !_root.isTickMarksCentered + yDisplacement : { + if ( _root.isTickMarksCentered ) { + return (_root.border.width/2 - 1) // had to subtract 1 to center on the _progressRect + } else { + return _root.tickMarkYDisplacement + } + } + color : _root.isActive ? Colors.borderButton : Colors.borderDisableButton + } + } + function updateHandleValue(vCurrentPositionX) { // Passing false for snapping to get exact value in respect to x