Index: sources/gui/qml/components/TickMarks.qml =================================================================== diff -u -rbbbd9cbf805779ef498a8f59cc74b9b597802a55 -r5f6975c6ee7823fc884328418298128cdb97107f --- sources/gui/qml/components/TickMarks.qml (.../TickMarks.qml) (revision bbbd9cbf805779ef498a8f59cc74b9b597802a55) +++ sources/gui/qml/components/TickMarks.qml (.../TickMarks.qml) (revision 5f6975c6ee7823fc884328418298128cdb97107f) @@ -35,92 +35,48 @@ property color color : Colors.backgroundDialog - property int orientation : Line.Orientation.Vertical - property int length : parent.height - property int thickness : 1 - property bool isTickMarkRound : false property real roundTickMarkDiameter : Variables.sliderDefaultRoundTickMarkDiameter property real yDisplacement : 0 property bool showFirstMark : true + // For the case that the tickmark is a line + property real lineTickMarkHeight : 20 + property real lineTickMarkThickness : 1 + property bool textVisible : false property color textColor : Colors.textMain anchors.fill: parent Repeater { id : _repeater + model: (maximum - minimum) / step + 1 - model: (maximum - minimum) / step // + 1 - - // TODO determine if using loader is ideal or prefer to use a single Rectangle that can be transformed into line or circle - Loader { + Rectangle { property int gap : stepSnap ? ( - (parent.width * (step - (minimum % step))) / (maximum - minimum) + (parent.width * (step - (minimum % step))) / (maximum - minimum) ) : 0 - property real componentX : (((index * step) * (parent.width - parent.x)) / (maximum - minimum)) + gap - property real componentY : _root.yDisplacement - - property int repeaterIndex: index - - sourceComponent: isTickMarkRound ? _roundTickMarkFactory : _lineTickMarkFactory - } - } - - Component { - id: _roundTickMarkFactory - // The round style tick marks - - // TODO need to determine if pre-existing "Circle.qml" component can be used here in place - Rectangle{ - visible : (repeaterIndex > 0) || (repeaterIndex === 0 && showFirstMark) - x : componentX - width/2 - y : componentY - color : _root.color - height : _root.roundTickMarkDiameter - width : _root.roundTickMarkDiameter - radius : _root.roundTickMarkDiameter - - Loader{ - readonly property int tickIndex: repeaterIndex - sourceComponent: textVisible ? _tickLabelFactory : undefined - } - } - } - - Component { - id: _lineTickMarkFactory - // The Line style tick marks - Line { - visible : (repeaterIndex > 0) || (repeaterIndex === 0 && showFirstMark) - x : componentX - width/2 - y : componentY + Variables.rangeRectBorderWidth // adjusting the y of the line tick to account for the slider border + 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 color : _root.color - orientation : _root.orientation - thickness : _root.thickness - length : _root.length - (Variables.rangeRectBorderWidth * 2) - Loader{ - readonly property int tickIndex: repeaterIndex - sourceComponent: textVisible ? _tickLabelFactory : undefined - } - } - } + height : isTickMarkRound ? _root.roundTickMarkDiameter : _root.lineTickMarkHeight + width : isTickMarkRound ? _root.roundTickMarkDiameter : _root.lineTickMarkThickness + radius : isTickMarkRound ? _root.roundTickMarkDiameter : 0 - Component { - id: _tickLabelFactory - // The value labels underneath the tick marks - Text { id : _text - visible: true - color: _root.textColor - font.pixelSize: 10 - text: ((tickIndex * step) + minimum).toFixed(decimal) - anchors { - top: parent.bottom - topMargin: 5 - horizontalCenter: parent.horizontalCenter + Text { id : _text + visible: _root.textVisible + color: _root.textColor + font.pixelSize: 10 + text: ((index * step) + minimum).toFixed(decimal) + anchors { + top: parent.bottom + topMargin: 5 + horizontalCenter: parent.horizontalCenter + } } } }