Reuse MaterialBrandSection component for Favorites, Generic and branded

materials.

This component will show different children depending on the
hasMaterialTypes flag.

Adjust some small UI issues.

Contributes to CURA-5682.
This commit is contained in:
Diego Prado Gesto 2018-09-17 12:08:41 +02:00
parent f871a89825
commit bafc2b98c9
6 changed files with 61 additions and 148 deletions

View file

@ -48,7 +48,7 @@ Rectangle
height: UM.Theme.getSize("favorites_row").height
width: parent.width - UM.Theme.getSize("favorites_button").width
verticalAlignment: Text.AlignVCenter
leftPadding: 4
leftPadding: (UM.Theme.getSize("default_margin").width / 2) | 0
}
Button
{
@ -101,6 +101,7 @@ Rectangle
}
Column
{
id: brandMaterialList
anchors.top: brand_header.bottom
width: parent.width
anchors.left: parent.left
@ -110,26 +111,14 @@ Rectangle
Repeater
{
model: elementsModel
delegate: Item
delegate: Loader
{
Loader
{
id: loader
property var element: model
sourceComponent: hasMaterialTypes ? materialsTypeSection : materialSlot
}
id: loader
width: parent.width
property var element: model
sourceComponent: hasMaterialTypes ? materialsTypeSection : materialSlot
}
}
// In case there are no types, we create a material slot
// Repeater
// {
// model: elementsModel
// delegate: MaterialsSlot
// {
// visible: !hasMaterialTypes
// material: model
// }
// }
}
Component