diff options
author | Jaime van Kessel <nallath@gmail.com> | 2021-11-11 18:51:03 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2021-11-11 18:51:03 +0300 |
commit | 75cd792b002436d91ccd0fe56486817fc3284405 (patch) | |
tree | c0c0e12589894bbe48b6b9c8012666f535f20cb6 /plugins/SimulationView | |
parent | 99a5aa363f3414b65a63a81352ebaa91f1138e93 (diff) |
Convert Layerview component to controls 2
Diffstat (limited to 'plugins/SimulationView')
-rw-r--r-- | plugins/SimulationView/SimulationSliderLabel.qml | 55 | ||||
-rw-r--r-- | plugins/SimulationView/SimulationViewMainComponent.qml | 1 | ||||
-rw-r--r-- | plugins/SimulationView/SimulationViewMenuComponent.qml | 1 |
3 files changed, 25 insertions, 32 deletions
diff --git a/plugins/SimulationView/SimulationSliderLabel.qml b/plugins/SimulationView/SimulationSliderLabel.qml index afd02069eb..850fff7440 100644 --- a/plugins/SimulationView/SimulationSliderLabel.qml +++ b/plugins/SimulationView/SimulationSliderLabel.qml @@ -1,14 +1,14 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2021 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.5 -import QtQuick.Controls 1.2 +import QtQuick.Controls 2.2 import QtQuick.Layouts 1.1 -import QtQuick.Controls.Styles 1.1 import UM 1.0 as UM import Cura 1.0 as Cura -UM.PointingRectangle { +UM.PointingRectangle +{ id: sliderLabelRoot // custom properties @@ -28,47 +28,40 @@ UM.PointingRectangle { borderColor: UM.Theme.getColor("lining") borderWidth: UM.Theme.getSize("default_lining").width - Behavior on height { - NumberAnimation { - duration: 50 - } - } + Behavior on height { NumberAnimation { duration: 50 } } // catch all mouse events so they're not handled by underlying 3D scene - MouseArea { + MouseArea + { anchors.fill: parent } - TextMetrics { + TextMetrics + { id: maxValueMetrics font: valueLabel.font text: maximumValue + 1 // layers are 0 based, add 1 for display value - } - TextField { + TextField + { id: valueLabel - anchors { - verticalCenter: parent.verticalCenter - horizontalCenter: parent.horizontalCenter - alignWhenCentered: false - } + anchors.centerIn: parent - width: maxValueMetrics.width + UM.Theme.getSize("default_margin").width + //width: maxValueMetrics.contentWidth + 2 * UM.Theme.getSize("default_margin").width text: sliderLabelRoot.value + startFrom // the current handle value, add 1 because layers is an array horizontalAlignment: TextInput.AlignHCenter + leftPadding: UM.Theme.getSize("narrow_margin").width + rightPadding: UM.Theme.getSize("narrow_margin").width // key bindings, work when label is currently focused (active handle in LayerSlider) Keys.onUpPressed: sliderLabelRoot.setValue(sliderLabelRoot.value + ((event.modifiers & Qt.ShiftModifier) ? 10 : 1)) Keys.onDownPressed: sliderLabelRoot.setValue(sliderLabelRoot.value - ((event.modifiers & Qt.ShiftModifier) ? 10 : 1)) - - style: TextFieldStyle { - textColor: UM.Theme.getColor("text") - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering - background: Item { } - } + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("default") + renderType: Text.NativeRendering + background: Item {} onEditingFinished: { @@ -84,16 +77,18 @@ UM.PointingRectangle { } } - validator: IntValidator { + validator: IntValidator + { bottom: startFrom top: sliderLabelRoot.maximumValue + startFrom // +startFrom because maybe we want to start in a different value rather than 0 } } - - BusyIndicator { + BusyIndicator + { id: busyIndicator - anchors { + anchors + { left: parent.right leftMargin: Math.round(UM.Theme.getSize("default_margin").width / 2) verticalCenter: parent.verticalCenter diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml index af60692273..aaea15025e 100644 --- a/plugins/SimulationView/SimulationViewMainComponent.qml +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -2,7 +2,6 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.4 -import QtQuick.Controls 1.2 import QtQuick.Layouts 1.1 import QtQuick.Controls.Styles 1.1 diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index 379da63c28..1e58fb23bb 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -2,7 +2,6 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.4 -import QtQuick.Controls 1.2 import QtQuick.Layouts 1.1 import QtQuick.Controls.Styles 1.1 import QtGraphicalEffects 1.0 |