Add identation for the materials preferences page

CURA-8979
This commit is contained in:
Jaime van Kessel 2022-03-15 10:16:49 +01:00
parent 5136838f56
commit 93405bdb93
4 changed files with 18 additions and 11 deletions

View File

@ -21,12 +21,13 @@ Button
height: UM.Theme.getSize("section_header").height height: UM.Theme.getSize("section_header").height
property var expanded: false property var expanded: false
property bool indented: false
property alias arrow: categoryArrow property alias arrow: categoryArrow
property alias categoryIcon: icon.source property alias categoryIcon: icon.source
property alias labelText: categoryLabel.text property alias labelText: categoryLabel.text
property alias labelFont: categoryLabel.font property alias labelFont: categoryLabel.font
leftPadding: UM.Theme.getSize("narrow_margin").width
rightPadding: UM.Theme.getSize("narrow_margin").width
states: states:
[ [
State State
@ -72,20 +73,21 @@ Button
} }
} }
contentItem: RowLayout contentItem: Item
{ {
id: content id: content
spacing: UM.Theme.getSize("narrow_margin").width //spacing: UM.Theme.getSize("narrow_margin").width
UM.RecolorImage UM.RecolorImage
{ {
id: icon id: icon
source: "" source: ""
visible: icon.source != "" visible: icon.source != ""
Layout.alignment: Qt.AlignHCenter anchors.verticalCenter: parent.verticalCenter
color: UM.Theme.getColor("setting_category_text") color: UM.Theme.getColor("setting_category_text")
width: UM.Theme.getSize("section_icon").width width: visible ? UM.Theme.getSize("section_icon").width: 0
height: UM.Theme.getSize("section_icon").height height: UM.Theme.getSize("section_icon").height
anchors.leftMargin: base.indented ? UM.Theme.getSize("default_margin").width: 0
sourceSize.width: width sourceSize.width: width
sourceSize.height: width sourceSize.height: width
} }
@ -94,7 +96,10 @@ Button
{ {
id: categoryLabel id: categoryLabel
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter anchors.right: categoryArrow.left
anchors.left: icon.right
anchors.leftMargin: base.indented ? UM.Theme.getSize("default_margin").width + UM.Theme.getSize("narrow_margin").width: UM.Theme.getSize("narrow_margin").width
anchors.verticalCenter: parent.verticalCenter
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.NoWrap wrapMode: Text.NoWrap
font: UM.Theme.getFont("medium_bold") font: UM.Theme.getFont("medium_bold")
@ -104,9 +109,10 @@ Button
UM.RecolorImage UM.RecolorImage
{ {
id: categoryArrow id: categoryArrow
Layout.alignment: Qt.AlignHCenter anchors.right: parent.right
width: UM.Theme.getSize("standard_arrow").width width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height height: UM.Theme.getSize("standard_arrow").height
anchors.verticalCenter: parent.verticalCenter
sourceSize.width: width sourceSize.width: width
sourceSize.height: height sourceSize.height: height
color: UM.Theme.getColor("setting_control_button") color: UM.Theme.getColor("setting_control_button")

View File

@ -18,7 +18,6 @@ Column
property var elementsModel // This can be a MaterialTypesModel or GenericMaterialsModel or FavoriteMaterialsModel property var elementsModel // This can be a MaterialTypesModel or GenericMaterialsModel or FavoriteMaterialsModel
property bool hasMaterialTypes: true // It indicates whether it has material types or not property bool hasMaterialTypes: true // It indicates whether it has material types or not
property bool expanded: materialList.expandedBrands.indexOf(sectionName) !== -1 property bool expanded: materialList.expandedBrands.indexOf(sectionName) !== -1
width: parent.width width: parent.width
Cura.CategoryButton Cura.CategoryButton
@ -68,6 +67,7 @@ Column
MaterialsTypeSection MaterialsTypeSection
{ {
materialType: element materialType: element
indented: true
} }
} }

View File

@ -47,7 +47,7 @@ Rectangle
radius: width / 2 radius: width / 2
anchors.verticalCenter: materialSlot.verticalCenter anchors.verticalCenter: materialSlot.verticalCenter
anchors.left: materialSlot.left anchors.left: materialSlot.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: 2 * UM.Theme.getSize("default_margin").width
} }
UM.Label UM.Label
{ {

View File

@ -16,11 +16,12 @@ Column
property string materialName: materialType !== null ? materialType.name : "" property string materialName: materialType !== null ? materialType.name : ""
property bool expanded: materialList.expandedTypes.indexOf(`${materialBrand}_${materialName}`) !== -1 property bool expanded: materialList.expandedTypes.indexOf(`${materialBrand}_${materialName}`) !== -1
property var colorsModel: materialType !== null ? materialType.colors : null property var colorsModel: materialType !== null ? materialType.colors : null
property alias indented: categoryButton.indented
width: parent.width width: parent.width
Cura.CategoryButton Cura.CategoryButton
{ {
id: categoryButton
width: parent.width width: parent.width
height: UM.Theme.getSize("favorites_row").height height: UM.Theme.getSize("favorites_row").height
labelText: materialName labelText: materialName