From 52eac6635f31252148ff7342ed05c93456828edc Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Mon, 9 Oct 2017 16:11:50 +0200 Subject: [PATCH] Improve layer slider label positions - CURA-4412 --- plugins/LayerView/LayerSlider.qml | 14 ++++++-------- plugins/LayerView/LayerSliderLabel.qml | 6 +++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/plugins/LayerView/LayerSlider.qml b/plugins/LayerView/LayerSlider.qml index 518a05557a..1ed672f8e3 100644 --- a/plugins/LayerView/LayerSlider.qml +++ b/plugins/LayerView/LayerSlider.qml @@ -185,10 +185,9 @@ Item { id: upperHandleLabel height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height - // width is calculated automatically from the input field width - x: parent.x - width // align with slider handle - y: parent.anchors.top - height // align with slider? handle - target: Qt.point(sliderRoot.width, parent.y + parent.height / 2) + x: parent.x - width - UM.Theme.getSize("default_margin").width + anchors.verticalCenter: parent.verticalCenter + target: Qt.point(sliderRoot.width, y + height / 2) visible: sliderRoot.layersVisible // custom properties @@ -265,10 +264,9 @@ Item { id: lowerHandleLabel height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height - // width is calculated automatically from the input field width - x: (parent.x + (parent.width / 2)) - width - 100 - y: Math.floor(parent.y + height / 2) - target: Qt.point(sliderRoot.width, parent.y + parent.height / 2) + x: parent.x - width - UM.Theme.getSize("default_margin").width + anchors.verticalCenter: parent.verticalCenter + target: Qt.point(sliderRoot.width, y + height / 2) visible: sliderRoot.layersVisible // custom properties diff --git a/plugins/LayerView/LayerSliderLabel.qml b/plugins/LayerView/LayerSliderLabel.qml index 875ec3ca01..2b469b07eb 100644 --- a/plugins/LayerView/LayerSliderLabel.qml +++ b/plugins/LayerView/LayerSliderLabel.qml @@ -13,13 +13,12 @@ UM.PointingRectangle { id: sliderLabelRoot // custom properties - property var target // Qt.point property real maximumValue: 100 property real value: 0 property var setValue // Function property bool busy: false - target: sliderLabelRoot.target + target: Qt.point(parent.width, y + height / 2) arrowSize: UM.Theme.getSize("default_arrow").width height: parent.height width: valueLabel.width + UM.Theme.getSize("default_margin").width @@ -50,7 +49,8 @@ UM.PointingRectangle { verticalCenter: parent.verticalCenter } - width: Math.max(UM.Theme.getSize("line").width * sliderLabelRoot.maximumValue.length + 2 * screenScaleFactor, 20 * screenScaleFactor) + // width is based on text field contents, but never smaller than 20pts + width: 40 * screenScaleFactor text: sliderLabelRoot.value + 1 // the current handle value, add 1 because layers is an array horizontalAlignment: TextInput.AlignRight