From 5ebdae9f1a7bd5b2dd7b963f091ee5ba3dba603e Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Tue, 29 Oct 2019 11:47:39 +0100 Subject: [PATCH 1/6] Move upper layer slider handle label to the top CURA-6854 --- plugins/SimulationView/LayerSlider.qml | 12 +++++++----- plugins/SimulationView/SimulationSliderLabel.qml | 10 +++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/plugins/SimulationView/LayerSlider.qml b/plugins/SimulationView/LayerSlider.qml index 15b0fdbe12..6622272a38 100644 --- a/plugins/SimulationView/LayerSlider.qml +++ b/plugins/SimulationView/LayerSlider.qml @@ -275,10 +275,12 @@ Item { id: upperHandleLabel - height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height - x: parent.x - parent.width - width - anchors.verticalCenter: parent.verticalCenter - target: Qt.point(sliderRoot.width, y + height / 2) + height: sliderRoot.handleSize + UM.Theme.getSize("small_margin").height + //x: parent.x + anchors.bottom: parent.top + anchors.bottomMargin: UM.Theme.getSize("narrow_margin").height + anchors.horizontalCenter: parent.horizontalCenter + target: Qt.point(parent.width / 2, parent.top) visible: sliderRoot.activeHandle == parent // custom properties @@ -397,4 +399,4 @@ Item setValue: lowerHandle.setValueManually // connect callback functions } } -} \ No newline at end of file +} diff --git a/plugins/SimulationView/SimulationSliderLabel.qml b/plugins/SimulationView/SimulationSliderLabel.qml index 06c6a51b44..a241a50145 100644 --- a/plugins/SimulationView/SimulationSliderLabel.qml +++ b/plugins/SimulationView/SimulationSliderLabel.qml @@ -20,9 +20,9 @@ UM.PointingRectangle { property int startFrom: 1 target: Qt.point(parent.width, y + height / 2) - arrowSize: UM.Theme.getSize("default_arrow").width + arrowSize: UM.Theme.getSize("button_tooltip_arrow").height height: parent.height - width: valueLabel.width + UM.Theme.getSize("default_margin").width + width: valueLabel.width visible: false color: UM.Theme.getColor("tool_panel_background") @@ -48,9 +48,9 @@ UM.PointingRectangle { horizontalCenter: parent.horizontalCenter } - width: ((maximumValue + 1).toString().length + 1) * 10 * screenScaleFactor + width: ((maximumValue + 1).toString().length + 1) * 8 * screenScaleFactor text: sliderLabelRoot.value + startFrom // the current handle value, add 1 because layers is an array - horizontalAlignment: TextInput.AlignRight + horizontalAlignment: TextInput.AlignHCenter // key bindings, work when label is currenctly focused (active handle in LayerSlider) Keys.onUpPressed: sliderLabelRoot.setValue(sliderLabelRoot.value + ((event.modifiers & Qt.ShiftModifier) ? 10 : 1)) @@ -58,7 +58,7 @@ UM.PointingRectangle { style: TextFieldStyle { textColor: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("small") background: Item { } } From e152529b5e097aacd4c7fffb7009b103e8fc1df1 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Tue, 29 Oct 2019 13:03:53 +0100 Subject: [PATCH 2/6] Increase layer slider margins to accomodate labels CURA-6854 --- plugins/SimulationView/SimulationViewMainComponent.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml index cd7d108370..8d32e50654 100644 --- a/plugins/SimulationView/SimulationViewMainComponent.qml +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -183,7 +183,7 @@ Item LayerSlider { property var preferredHeight: UM.Theme.getSize("slider_layerview_size").height - property double heightMargin: UM.Theme.getSize("default_margin").height + property double heightMargin: UM.Theme.getSize("default_margin").height * 3 // extra margin to accomodate layer number tooltips id: layerSlider width: UM.Theme.getSize("slider_handle").width From ba766c3a1935accef170e2174e2745bf905842a0 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Tue, 29 Oct 2019 13:23:43 +0100 Subject: [PATCH 3/6] Move lower layer slider handle label to the bottom CURA-6854 --- plugins/SimulationView/LayerSlider.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/SimulationView/LayerSlider.qml b/plugins/SimulationView/LayerSlider.qml index 6622272a38..c1be13c628 100644 --- a/plugins/SimulationView/LayerSlider.qml +++ b/plugins/SimulationView/LayerSlider.qml @@ -276,7 +276,6 @@ Item id: upperHandleLabel height: sliderRoot.handleSize + UM.Theme.getSize("small_margin").height - //x: parent.x anchors.bottom: parent.top anchors.bottomMargin: UM.Theme.getSize("narrow_margin").height anchors.horizontalCenter: parent.horizontalCenter @@ -386,10 +385,11 @@ Item { id: lowerHandleLabel - height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height - x: parent.x - parent.width - width - anchors.verticalCenter: parent.verticalCenter - target: Qt.point(sliderRoot.width + width, y + height / 2) + height: sliderRoot.handleSize + UM.Theme.getSize("small_margin").height + anchors.top: parent.bottom + anchors.topMargin: UM.Theme.getSize("narrow_margin").height + anchors.horizontalCenter: parent.horizontalCenter + target: Qt.point(parent.width / 2, parent.bottom) visible: sliderRoot.activeHandle == parent // custom properties From 3db5abbd3ac0d1561b03d9081ebda22c2d0d3518 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Tue, 29 Oct 2019 13:39:52 +0100 Subject: [PATCH 4/6] Move layer slider range handle label to below the vertical center CURA-6854 --- plugins/SimulationView/LayerSlider.qml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/SimulationView/LayerSlider.qml b/plugins/SimulationView/LayerSlider.qml index c1be13c628..4ff959370c 100644 --- a/plugins/SimulationView/LayerSlider.qml +++ b/plugins/SimulationView/LayerSlider.qml @@ -161,11 +161,10 @@ Item SimulationSliderLabel { id: rangleHandleLabel - - height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height - x: parent.x - width - UM.Theme.getSize("default_margin").width - anchors.verticalCenter: parent.verticalCenter - target: Qt.point(sliderRoot.width, y + height / 2) + y: parent.height / 2 + height: sliderRoot.handleSize + UM.Theme.getSize("small_margin").height + anchors.horizontalCenter: parent.horizontalCenter + target: Qt.point(parent.width / 2, y -100) visible: sliderRoot.activeHandle == parent // custom properties From 888c3f51a5718c80f9b3736aa86e5953e1c4ed8d Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Tue, 29 Oct 2019 14:11:09 +0100 Subject: [PATCH 5/6] Show both handle labels instead of the range label Now that the labels are horizontally centered with the handles, the range label would overlap the bottom handle. So instead, delete the range handle and show both other handles instead. CURA-6854 --- plugins/SimulationView/LayerSlider.qml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/plugins/SimulationView/LayerSlider.qml b/plugins/SimulationView/LayerSlider.qml index 4ff959370c..eff27c43a7 100644 --- a/plugins/SimulationView/LayerSlider.qml +++ b/plugins/SimulationView/LayerSlider.qml @@ -158,21 +158,6 @@ Item onPressed: sliderRoot.setActiveHandle(rangeHandle) } - SimulationSliderLabel - { - id: rangleHandleLabel - y: parent.height / 2 - height: sliderRoot.handleSize + UM.Theme.getSize("small_margin").height - anchors.horizontalCenter: parent.horizontalCenter - target: Qt.point(parent.width / 2, y -100) - visible: sliderRoot.activeHandle == parent - - // custom properties - maximumValue: sliderRoot.maximumValue - value: sliderRoot.upperValue - busy: UM.SimulationView.busy - setValue: rangeHandle.setValueManually // connect callback functions - } } onHeightChanged : { @@ -279,7 +264,7 @@ Item anchors.bottomMargin: UM.Theme.getSize("narrow_margin").height anchors.horizontalCenter: parent.horizontalCenter target: Qt.point(parent.width / 2, parent.top) - visible: sliderRoot.activeHandle == parent + visible: sliderRoot.activeHandle == parent || sliderRoot.activeHandle == rangeHandle // custom properties maximumValue: sliderRoot.maximumValue @@ -389,7 +374,7 @@ Item anchors.topMargin: UM.Theme.getSize("narrow_margin").height anchors.horizontalCenter: parent.horizontalCenter target: Qt.point(parent.width / 2, parent.bottom) - visible: sliderRoot.activeHandle == parent + visible: sliderRoot.activeHandle == parent || sliderRoot.activeHandle == rangeHandle // custom properties maximumValue: sliderRoot.maximumValue From 96bd641d93290ca38fea33667a4c64f780c52ecb Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 1 Nov 2019 11:06:16 +0100 Subject: [PATCH 6/6] Fix: upper/lower handle not losing focus when range handle pressed --- plugins/SimulationView/LayerSlider.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/SimulationView/LayerSlider.qml b/plugins/SimulationView/LayerSlider.qml index eff27c43a7..0c62dd01cf 100644 --- a/plugins/SimulationView/LayerSlider.qml +++ b/plugins/SimulationView/LayerSlider.qml @@ -155,7 +155,11 @@ Item } onPositionChanged: parent.onHandleDragged() - onPressed: sliderRoot.setActiveHandle(rangeHandle) + onPressed: + { + sliderRoot.setActiveHandle(rangeHandle) + sliderRoot.forceActiveFocus() + } } }