Getting setting section sized properly

CURA-9793
This commit is contained in:
Joey de l'Arago 2022-11-25 17:42:50 +01:00
parent ac2e733ea6
commit eb13ac7f6b
4 changed files with 41 additions and 19 deletions

View File

@ -10,7 +10,6 @@ import Cura 1.0 as Cura
RecommendedSettingSection RecommendedSettingSection
{ {
id: enableAdhesionRow id: enableAdhesionRow
height: enableAdhesionContainer.height
title: catalog.i18nc("@label", "Adhesion") title: catalog.i18nc("@label", "Adhesion")
icon: UM.Theme.getIcon("Adhesion") icon: UM.Theme.getIcon("Adhesion")
@ -20,17 +19,29 @@ RecommendedSettingSection
property var curaRecommendedMode: Cura.RecommendedMode {} property var curaRecommendedMode: Cura.RecommendedMode {}
function onEnableSectionChanged(state) { property UM.SettingPropertyProvider platformAdhesionType: UM.SettingPropertyProvider
curaRecommendedMode.setAdhesion(state)
}
UM.SettingPropertyProvider
{ {
id: platformAdhesionType
containerStack: Cura.MachineManager.activeMachine containerStack: Cura.MachineManager.activeMachine
removeUnusedValue: false //Doesn't work with settings that are resolved. removeUnusedValue: false //Doesn't work with settings that are resolved.
key: "adhesion_type" key: "adhesion_type"
watchedProperties: [ "value", "resolve", "enabled" ] watchedProperties: [ "value", "resolve", "enabled" ]
storeIndex: 0 storeIndex: 0
} }
function onEnableSectionChanged(state) {
curaRecommendedMode.setAdhesion(state)
}
contents: RecommendedSettingItem
{
settingName: catalog.i18nc("@action:label", "Print with")
settingControl: Rectangle
{
width: 20
height: 20
color: Qt.rgba(1, 0, 0, .5)
}
}
} }

View File

@ -98,7 +98,10 @@ Item
Layout.fillWidth: true Layout.fillWidth: true
} }
RecommendedAdhesionSelector {} RecommendedAdhesionSelector {
width: parent.width
Layout.fillWidth: true
}
} }
UM.SettingPropertyProvider UM.SettingPropertyProvider

View File

@ -11,26 +11,30 @@ import Cura 1.7 as Cura
Item Item
{ {
property Component content: Item { visible: false } width: parent.width
height: UM.Theme.getSize("section_header").height
property alias settingControl: settingContainer.children
property alias settingName: settingLabel.text property alias settingName: settingLabel.text
property int leftColumnWidth: width / 2
UM.Label UM.Label
{ {
id: settingLabel id: settingLabel
width: leftColumnWidth
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: "TEST" // These numbers come from the IconWithText in RecommendedSettingSection
anchors.leftMargin: UM.Theme.getSize("medium_button_icon").width + UM.Theme.getSize("thick_margin").width - UM.Theme.getSize("thick_lining").width
} }
Loader Loader
{ {
id: settingLoader id: settingContainer
width: parent.width height: childrenRect.height
height: content.height
anchors.left: settingLabel.right anchors.left: settingLabel.right
anchors.right: parent.right anchors.right: parent.right
anchers.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
sourceComponent: content
} }
} }

View File

@ -20,15 +20,19 @@ Item
property var enableSectionClicked: { return } property var enableSectionClicked: { return }
property int leftColumnWidth: width / 2 property int leftColumnWidth: width / 2
property alias contents: settingColumn.children
function onEnableSectionChanged(state) {} function onEnableSectionChanged(state) {}
height: childrenRect.height height: childrenRect.height
width: parent.width
Item Item
{ {
id: sectionHeader id: sectionHeader
anchors.top: parent.top
anchors.right: parent.right
anchors.left: parent.left
height: UM.Theme.getSize("section_header").height
Cura.IconWithText Cura.IconWithText
{ {
@ -71,8 +75,8 @@ Item
{ {
id: contentLoader id: contentLoader
width: parent.width width: parent.width
height: content.height height: childrenRect.height
anchors.left: settingLabel.right anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
sourceComponent: content sourceComponent: content