Move required settingPropertyProvider into InfillSlider.

Use new RecommendedSetting components for Strength section of recommended.

CURA-9793
This commit is contained in:
Joey de l'Arago 2022-11-29 17:50:40 +01:00
parent f99f1a4528
commit 7ba0281136
5 changed files with 45 additions and 98 deletions

View File

@ -15,9 +15,18 @@ RowLayout
anchors anchors
{ {
left: infillRowTitle.right left: strengthSection.right
right: parent.right right: parent.right
verticalCenter: infillRowTitle.verticalCenter verticalCenter: strengthSection.verticalCenter
}
UM.SettingPropertyProvider
{
id: infillDensity
containerStackId: Cura.MachineManager.activeStackId
key: "infill_sparse_density"
watchedProperties: [ "value" ]
storeIndex: 0
} }
UM.Label { Layout.fillWidth: false; text: "0" } UM.Label { Layout.fillWidth: false; text: "0" }

View File

@ -86,9 +86,7 @@ Item
RecommendedStrengthSelector RecommendedStrengthSelector
{ {
width: parent.width width: parent.width
labelColumnWidth: parent.firstColumnWidth
Layout.fillWidth: true Layout.fillWidth: true
Layout.rightMargin: UM.Theme.getSize("default_margin").width
} }
RecommendedSupportSelector RecommendedSupportSelector

View File

@ -18,6 +18,7 @@ Item
property alias settingControl: settingContainer.children property alias settingControl: settingContainer.children
property alias settingName: settingLabel.text property alias settingName: settingLabel.text
property string tooltipText: ""
UM.Label UM.Label
{ {

View File

@ -5,108 +5,39 @@ import QtQuick 2.7
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.7 as Cura
// RecommendedSettingSection
// Infill
//
Item
{ {
id: infillRow id: strengthSection
height: childrenRect.height
property real labelColumnWidth: Math.round(width / 3) title: catalog.i18nc("@label", "Strength")
icon: UM.Theme.getIcon("Hammer")
enableSectionVisible: false
enableSectionEnabled: false
// Here are the elements that are shown in the left column contents: [
Cura.IconWithText RecommendedSettingItem
{
id: infillRowTitle
anchors.top: parent.top
anchors.left: parent.left
source: UM.Theme.getIcon("Infill1")
text: `${catalog.i18nc("@label", "Infill")} (%)`
font: UM.Theme.getFont("medium")
width: labelColumnWidth
iconSize: UM.Theme.getSize("medium_button_icon").width
tooltipText: catalog.i18nc("@label", "Gradual infill will gradually increase the amount of infill towards the top.")
}
InfillSlider
{
id: infillSliderContainer
height: childrenRect.height
}
// Gradual Support Infill Checkbox
UM.CheckBox
{
id: enableGradualInfillCheckBox
property alias _hovered: enableGradualInfillMouseArea.containsMouse
anchors.top: infillSliderContainer.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.left: infillSliderContainer.left
text: catalog.i18nc("@label", "Gradual infill")
enabled: recommendedPrintSetup.settingsEnabled
visible: infillSteps.properties.enabled == "True"
checked: parseInt(infillSteps.properties.value) > 0
MouseArea
{ {
id: enableGradualInfillMouseArea settingName: catalog.i18nc("@action:label", "Infill Density")
tooltipText: catalog.i18nc("@label", "Gradual infill will gradually increase the amount of infill towards the top.")
anchors.fill: parent settingControl: InfillSlider
hoverEnabled: true
enabled: true
property var previousInfillDensity: parseInt(infillDensity.properties.value)
onClicked:
{ {
// Set to 90% only when enabling gradual infill height: UM.Theme.getSize("combobox").height
var newInfillDensity; width: parent.width
if (parseInt(infillSteps.properties.value) == 0)
{
previousInfillDensity = parseInt(infillDensity.properties.value)
newInfillDensity = 90
} else {
newInfillDensity = previousInfillDensity
}
Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", String(newInfillDensity))
var infill_steps_value = 0
if (parseInt(infillSteps.properties.value) == 0)
{
infill_steps_value = 5
}
Cura.MachineManager.setSettingForAllExtruders("gradual_infill_steps", "value", infill_steps_value)
} }
},
RecommendedSettingItem
{
settingName: catalog.i18nc("@action:label", "Infill Pattern")
onEntered: base.showTooltip(enableGradualInfillCheckBox, Qt.point(-infillSliderContainer.x - UM.Theme.getSize("thick_margin").width, 0), settingControl: Cura.SingleSettingComboBox
catalog.i18nc("@label", "Gradual infill will gradually increase the amount of infill towards the top.")) {
width: parent.width
onExited: base.hideTooltip() height: UM.Theme.getSize("combobox").height
settingName: "infill_pattern"
}
} }
} ]
UM.SettingPropertyProvider
{
id: infillDensity
containerStackId: Cura.MachineManager.activeStackId
key: "infill_sparse_density"
watchedProperties: [ "value" ]
storeIndex: 0
}
UM.SettingPropertyProvider
{
id: infillSteps
containerStackId: Cura.MachineManager.activeStackId
key: "gradual_infill_steps"
watchedProperties: ["value", "enabled"]
storeIndex: 0
}
} }

View File

@ -0,0 +1,8 @@
<!--
- Copyright (c) 2022 UltiMaker.
- Cura is released under the terms of the LGPLv3 or higher.
-->
<svg width="19" height="17" viewBox="0 0 19 17" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.98284 16.8333C3.79951 16.8164 4.57846 16.4864 5.15864 15.9114L11.5224 9.54669L13.644 11.6682L18.5932 6.71899L11.9359 0.0618896H6.86594L4.45194 2.47589L7.27974 5.30399L0.915442 11.6682C0.626362 11.9408 0.396043 12.2696 0.238623 12.6345C0.0812019 12.9993 0 13.3924 0 13.7898C0 14.1871 0.0812019 14.5803 0.238623 14.9451C0.396043 15.31 0.626362 15.6388 0.915442 15.9114C1.17985 16.1968 1.49937 16.4257 1.85471 16.5841C2.21005 16.7426 2.59382 16.8273 2.98284 16.8333ZM7.69384 2.06189H11.1078L15.7651 6.71909L13.644 8.84019L7.27974 2.47579L7.69384 2.06189ZM2.33544 13.0764L8.69384 6.71799L10.1078 8.13309L3.74454 14.4973C3.65152 14.5911 3.54085 14.6656 3.41891 14.7164C3.29696 14.7672 3.16616 14.7933 3.03406 14.7934C2.90195 14.7934 2.77115 14.7672 2.6492 14.7164C2.52726 14.6656 2.41658 14.5911 2.32356 14.4973C2.23053 14.4035 2.15701 14.2922 2.10722 14.1699C2.05743 14.0475 2.03236 13.9165 2.03347 13.7844C2.03457 13.6523 2.06182 13.5217 2.11365 13.4002C2.16548 13.2787 2.24086 13.1686 2.33544 13.0764Z" fill="#000E1A"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB