Merge pull request #14046 from Ultimaker/CURA-9793

Cura 9793
This commit is contained in:
Joey de l'Arago 2022-12-15 09:27:40 +01:00 committed by GitHub
commit eab43f038a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 20 deletions

View File

@ -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. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.11 import QtQuick 2.11
@ -12,7 +12,7 @@ Item
property color materialColor property color materialColor
property alias textColor: extruderNumberText.color property alias textColor: extruderNumberText.color
property bool extruderEnabled: true 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 string iconVariant: "medium"
property alias font: extruderNumberText.font property alias font: extruderNumberText.font
@ -36,7 +36,6 @@ Item
} }
UM.ColorImage UM.ColorImage
{ {
id: mainIcon
anchors.fill: parent anchors.fill: parent
width: iconSize width: iconSize
height: iconSize height: iconSize
@ -48,12 +47,14 @@ Item
UM.Label UM.Label
{ {
id: extruderNumberText id: extruderNumberText
anchors.centerIn: parent
text: index + 1
font: UM.Theme.getFont("small_emphasis")
width: contentWidth width: contentWidth
height: contentHeight height: contentHeight
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.right: parent.right
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: (index + 1).toString()
font: UM.Theme.getFont("small_emphasis")
} }
} }
} }

View File

@ -67,6 +67,10 @@ Item
top: parent.top top: parent.top
} }
visible: currentModeIndex == PrintSetupSelectorContents.Mode.Recommended 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() function onModeChanged()
{ {

View File

@ -2,34 +2,41 @@
//Cura is released under the terms of the LGPLv3 or higher. //Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import UM 1.6 as UM import UM 1.6 as UM
import Cura 1.6 as Cura import Cura 1.6 as Cura
import ".." import ".."
Item ScrollView
{ {
id: recommendedPrintSetup id: recommendedPrintSetup
height: childrenRect.height + 2 * padding implicitHeight: settingsColumn.height + 2 * padding
property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 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() {} function onModeChanged() {}
Column ScrollBar.vertical: UM.ScrollBar {
{ id: scroll
spacing: UM.Theme.getSize("default_margin").height
anchors anchors
{ {
left: parent.left
right: parent.right
top: parent.top 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 // TODO
property real firstColumnWidth: Math.round(width / 3) property real firstColumnWidth: Math.round(width / 3)

View File

@ -87,15 +87,17 @@ UM.TextField
function parseValueUpdateSetting() 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 // Don't set the property value from the control. It already has the same value
return 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") color: UM.Theme.getColor("setting_validation_warning_background")
} }
}, },
State State
{ {
name: "disabled" name: "disabled"
when: !control.enabled when: !control.enabled