From 564fefa1c732dfd3aad8faffb44b545f62a1cfca Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Tue, 13 Dec 2022 11:46:06 +0100 Subject: [PATCH 1/4] Fix updating value with "," instead of "." in reccomended mode Fixed by correctly parsing dot in `SingleSettingTextField`. CURA-9793 --- resources/qml/Widgets/SingleSettingTextField.qml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/resources/qml/Widgets/SingleSettingTextField.qml b/resources/qml/Widgets/SingleSettingTextField.qml index 5bff7fdb5a..12d24d285d 100644 --- a/resources/qml/Widgets/SingleSettingTextField.qml +++ b/resources/qml/Widgets/SingleSettingTextField.qml @@ -87,15 +87,17 @@ UM.TextField function parseValueUpdateSetting() { - if (propertyProvider.properties.value === text || (parseFloat(propertyProvider.properties.value) === parseFloat(text))) + // User convenience. We use dots for decimal values + const modified_text = text.replace(",", "."); + if (propertyProvider.properties.value === modified_text || (parseFloat(propertyProvider.properties.value) === parseFloat(modified_text))) { // Don't set the property value from the control. It already has the same value return } - if (propertyProvider && text !== propertyProvider.properties.value) + if (propertyProvider && modified_text !== propertyProvider.properties.value) { - updateSetting(text); + updateSetting(modified_text); } } @@ -138,7 +140,7 @@ UM.TextField color: UM.Theme.getColor("setting_validation_warning_background") } }, - State + State { name: "disabled" when: !control.enabled From 83603ec8fab50440403f231c70dd0ddd64e110f9 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Tue, 13 Dec 2022 14:36:27 +0100 Subject: [PATCH 2/4] Center extruder icon in recommended settings CURA-9793 --- resources/qml/ExtruderIcon.qml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index c59521cdc3..93c5adf55a 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Ultimaker B.V. +// Copyright (c) 2022 UltiMaker // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.11 @@ -12,7 +12,7 @@ Item property color materialColor property alias textColor: extruderNumberText.color property bool extruderEnabled: true - property var iconSize: UM.Theme.getSize("extruder_icon").width + property int iconSize: UM.Theme.getSize("extruder_icon").width property string iconVariant: "medium" property alias font: extruderNumberText.font @@ -36,7 +36,6 @@ Item } UM.ColorImage { - id: mainIcon anchors.fill: parent width: iconSize height: iconSize @@ -48,12 +47,14 @@ Item UM.Label { id: extruderNumberText - anchors.centerIn: parent - text: index + 1 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: Text.AlignHCenter + text: (index + 1).toString() font: UM.Theme.getFont("small_emphasis") width: contentWidth height: contentHeight - horizontalAlignment: Text.AlignHCenter } } } From 2c7bd7883a4b725ac6ae2429e55ef27c6e486da7 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Tue, 13 Dec 2022 17:05:51 +0100 Subject: [PATCH 3/4] Make recommended mode-window scrollable CURA-9793 --- .../PrintSetupSelectorContents.qml | 4 +++ .../Recommended/RecommendedPrintSetup.qml | 27 ++++++++++++------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 9d3da51356..52a22c6c76 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -67,6 +67,10 @@ Item top: parent.top } visible: currentModeIndex == PrintSetupSelectorContents.Mode.Recommended + height: { + const height = base.height - (customPrintSetup.mapToItem(null, 0, 0).y + buttonRow.height + UM.Theme.getSize("default_margin").height); + return Math.min(implicitHeight, height); + } function onModeChanged() { diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index f78ae38dce..80e171bed4 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -2,34 +2,41 @@ //Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 +import QtQuick.Controls 2.15 import QtQuick.Layouts 1.1 import UM 1.6 as UM import Cura 1.6 as Cura import ".." -Item +ScrollView { id: recommendedPrintSetup - height: childrenRect.height + 2 * padding + implicitHeight: settingsColumn.height + 2 * padding property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 - property real padding: UM.Theme.getSize("default_margin").width + + padding: UM.Theme.getSize("default_margin").width function onModeChanged() {} - Column - { - spacing: UM.Theme.getSize("default_margin").height - + ScrollBar.vertical: UM.ScrollBar { + id: scroll anchors { - left: parent.left - right: parent.right top: parent.top - margins: parent.padding + right: parent.right + bottom: parent.bottom } + } + + Column + { + id: settingsColumn + spacing: UM.Theme.getSize("default_margin").height + + width: recommendedPrintSetup.width - 2 * recommendedPrintSetup.padding - (scroll.visible ? scroll.width : 0) // TODO property real firstColumnWidth: Math.round(width / 3) From ffb59b28942f78b7d709a545f564e7b9bfb4d75f Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Wed, 14 Dec 2022 17:44:08 +0100 Subject: [PATCH 4/4] Move width, height properties to top of component CURA-9793 --- resources/qml/ExtruderIcon.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index 93c5adf55a..3231d924ee 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -47,14 +47,14 @@ Item UM.Label { id: extruderNumberText + width: contentWidth + height: contentHeight anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.right: parent.right horizontalAlignment: Text.AlignHCenter text: (index + 1).toString() font: UM.Theme.getFont("small_emphasis") - width: contentWidth - height: contentHeight } } }