Index: sources/gui/qml/components/RangeMarker.qml =================================================================== diff -u -r7caa737179a8c31825ae6445f593ac7ff5f95080 -r1164ea502e3fabdb55aa41923e0e566505f197ef --- sources/gui/qml/components/RangeMarker.qml (.../RangeMarker.qml) (revision 7caa737179a8c31825ae6445f593ac7ff5f95080) +++ sources/gui/qml/components/RangeMarker.qml (.../RangeMarker.qml) (revision 1164ea502e3fabdb55aa41923e0e566505f197ef) @@ -28,11 +28,9 @@ property int decimal : 0 property alias text : _textValue - property alias handle : _handle property alias font : _textValue.font property color color : Colors.rangeMarker property alias thickness : _root.width - property alias hasHandle : _handle.visible property bool valueOnTop : false property string unitText : "" @@ -43,19 +41,6 @@ bottom : parent.bottom } - Rectangle { id: _handle - visible : false - - width : _root.width * 3 - height : _root.width * 3 - radius : _root.width * 3 - color : _root.color - anchors { - top : _root.top - horizontalCenter: parent.horizontalCenter - } - } - Rectangle { id: _stick width : _root.width height : _root.height @@ -69,18 +54,37 @@ Text { id: _textValue font { pixelSize : Fonts.fontPixelRangeMarker - bold : true + weight : Font.Medium } anchors { - right : parent.left + right : valueOnTop ? parent.left : undefined top : valueOnTop ? undefined : parent.top - bottom : valueOnTop ? _handle.top : + bottom : valueOnTop ? _stick.top : undefined bottomMargin: valueOnTop ? 5 : 0 rightMargin : valueOnTop ? -12 : 5 topMargin : valueOnTop ? 0 : -5 + horizontalCenter: valueOnTop ? _stick.horizontalCenter : undefined + horizontalCenterOffset: { + if (valueOnTop) { + if (_root.parent !== undefined) { + let xDelta = (_root.width-implicitWidth)/2 + // left boundary + if (_root.x + xDelta < 0) { + return -(_root.x + xDelta) + } + // right boundary + let rightOverflow = _root.x + _root.width - xDelta + if (rightOverflow > _root.parent.width) { + return -(rightOverflow - _root.parent.width) + } + } + } + return 0 + } } + horizontalAlignment: valueOnTop ? Text.AlignHCenter : Text.AlignLeft color : _root.color text : value.toFixed(decimal) + " " + unitText }