Index: sources/gui/qml/components/TickMarks.qml =================================================================== diff -u -r7b4219600ec64c2860113225ced0b5fc839b8ad2 -r8d7f8d2ac6620e92ab3cd239d7d8641113ea3e53 --- sources/gui/qml/components/TickMarks.qml (.../TickMarks.qml) (revision 7b4219600ec64c2860113225ced0b5fc839b8ad2) +++ sources/gui/qml/components/TickMarks.qml (.../TickMarks.qml) (revision 8d7f8d2ac6620e92ab3cd239d7d8641113ea3e53) @@ -38,7 +38,7 @@ property bool isTickMarkRound : false property real roundTickMarkDiameter : Variables.sliderDefaultRoundTickMarkDiameter property real yDisplacement : 0 - property bool showFirstMark : true + property bool showEndMarks : true // For the case that the tickmark is a line property real lineTickMarkHeight : 20 @@ -47,22 +47,17 @@ property bool textVisible : false property color textColor : Colors.textMain - property bool isDebugPrint: false - anchors.fill: parent Repeater { id : _repeater - model: (maximum - minimum) / step + 1 + readonly property real totalTickCount: ((maximum - minimum) / step + 1) // added property for clarity - Rectangle { - property int gap : stepSnap ? - ( - (parent.width * (step - (minimum % step))) / (maximum - minimum) - ) : 0 + model: totalTickCount - visible : (index > 0) || (index === 0 && showFirstMark) - x : (((index * step) * (parent.width - parent.x)) / (maximum - minimum)) + gap - width/2 - y : _root.yDisplacement + Variables.rangeRectBorderWidth // adjusting the y of the line tick to account for the slider border + Rectangle { + visible : _repeater.isTickMarkVisible(index) + x : (((index * step) * (parent.width - parent.x)) / (maximum - minimum)) - width/2 - 2 // "-width/2 - 2" for moving tick mark to center on handle + y : _root.yDisplacement color : _root.color height : isTickMarkRound ? _root.roundTickMarkDiameter : _root.lineTickMarkHeight @@ -81,5 +76,17 @@ } } } + + function isTickMarkVisible(index) { + if (showEndMarks) { + return true // all marks shown + } else { + // Only the center marks are shown, ie: exclude the end marks + if ((index > 0) && (index < (_repeater.totalTickCount-1))) { + return true + } + } + return false + } } }