mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-12-05 16:51:12 -07:00
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:
parent
f871a89825
commit
bafc2b98c9
6 changed files with 61 additions and 148 deletions
|
|
@ -13,7 +13,6 @@ import Cura 1.0 as Cura
|
|||
Item
|
||||
{
|
||||
id: materialList
|
||||
width: materialScrollView.width - 17
|
||||
height: childrenRect.height
|
||||
|
||||
// Children
|
||||
|
|
@ -121,93 +120,16 @@ Item
|
|||
|
||||
Column
|
||||
{
|
||||
// Rectangle
|
||||
// {
|
||||
// property var expanded: true
|
||||
//
|
||||
// id: favorites_section
|
||||
// height: childrenRect.height
|
||||
// width: materialList.width
|
||||
// Rectangle
|
||||
// {
|
||||
// id: favorites_header_background
|
||||
// color: UM.Theme.getColor("favorites_header_bar")
|
||||
// anchors.fill: favorites_header
|
||||
// }
|
||||
// Row
|
||||
// {
|
||||
// id: favorites_header
|
||||
// Label
|
||||
// {
|
||||
// id: favorites_name
|
||||
// text: "Favorites"
|
||||
// height: UM.Theme.getSize("favorites_row").height
|
||||
// width: materialList.width - UM.Theme.getSize("favorites_button").width
|
||||
// verticalAlignment: Text.AlignVCenter
|
||||
// leftPadding: 4
|
||||
// }
|
||||
// Button
|
||||
// {
|
||||
// text: ""
|
||||
// implicitWidth: UM.Theme.getSize("favorites_button").width
|
||||
// implicitHeight: UM.Theme.getSize("favorites_button").height
|
||||
// UM.RecolorImage {
|
||||
// anchors
|
||||
// {
|
||||
// verticalCenter: parent.verticalCenter
|
||||
// horizontalCenter: parent.horizontalCenter
|
||||
// }
|
||||
// width: UM.Theme.getSize("standard_arrow").width
|
||||
// height: UM.Theme.getSize("standard_arrow").height
|
||||
// sourceSize.width: width
|
||||
// sourceSize.height: height
|
||||
// color: "black"
|
||||
// source: favorites_section.expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
||||
// }
|
||||
// style: ButtonStyle
|
||||
// {
|
||||
// background: Rectangle
|
||||
// {
|
||||
// anchors.fill: parent
|
||||
// color: "transparent"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// MouseArea
|
||||
// {
|
||||
// anchors.fill: favorites_header
|
||||
// onPressed:
|
||||
// {
|
||||
// favorites_section.expanded = !favorites_section.expanded
|
||||
// }
|
||||
// }
|
||||
// Column
|
||||
// {
|
||||
// anchors.top: favorites_header.bottom
|
||||
// anchors.left: parent.left
|
||||
// width: materialList.width
|
||||
// height: favorites_section.expanded ? childrenRect.height : 0
|
||||
// visible: favorites_section.expanded
|
||||
// Repeater
|
||||
// {
|
||||
// model: favoriteMaterialsModel
|
||||
// delegate: MaterialsSlot
|
||||
// {
|
||||
// material: model
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
width: materialList.width
|
||||
height: childrenRect.height
|
||||
|
||||
// MaterialsBrandSection
|
||||
// {
|
||||
// id: favoriteSection
|
||||
// sectionName: "Favorites"
|
||||
// elementsModel: favoriteMaterialsModel
|
||||
// hasMaterialTypes: false
|
||||
// expanded: true
|
||||
// }
|
||||
MaterialsBrandSection
|
||||
{
|
||||
id: favoriteSection
|
||||
sectionName: "Favorites"
|
||||
elementsModel: favoriteMaterialsModel
|
||||
hasMaterialTypes: false
|
||||
}
|
||||
|
||||
MaterialsBrandSection
|
||||
{
|
||||
|
|
@ -216,18 +138,17 @@ Item
|
|||
elementsModel: genericMaterialsModel
|
||||
hasMaterialTypes: false
|
||||
}
|
||||
//
|
||||
// Repeater
|
||||
// {
|
||||
// id: brand_list
|
||||
// model: materialsModel
|
||||
// delegate: MaterialsBrandSection
|
||||
// {
|
||||
// id: brandSection
|
||||
// sectionName: model.name
|
||||
// elementsModel: model.material_types
|
||||
// hasMaterialTypes: true
|
||||
// }
|
||||
// }
|
||||
|
||||
Repeater
|
||||
{
|
||||
model: materialsModel
|
||||
delegate: MaterialsBrandSection
|
||||
{
|
||||
id: brandSection
|
||||
sectionName: model.name
|
||||
elementsModel: model.material_types
|
||||
hasMaterialTypes: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue