Highlight the material that is currently selected.

Contributes to CURA-5682.
This commit is contained in:
Diego Prado Gesto 2018-09-12 14:09:29 +02:00
parent 6d2492e5cb
commit 56dcc2dded

View File

@ -19,19 +19,8 @@ Rectangle
height: UM.Theme.getSize("favorites_row").height height: UM.Theme.getSize("favorites_row").height
width: parent.width width: parent.width
color: base.currentItem == model ? UM.Theme.getColor("favorites_row_selected") : "transparent" color: base.currentItem.root_material_id == material.root_material_id ? UM.Theme.getColor("favorites_row_selected") : "transparent"
Component.onCompleted:
{
if (material.root_material_id == base.active_root_material_id) {
base.currentItem = material
}
}
Item
{
height: parent.height
width: parent.width
Rectangle Rectangle
{ {
id: swatch id: swatch
@ -58,9 +47,9 @@ Rectangle
anchors.fill: parent anchors.fill: parent
onClicked: onClicked:
{ {
base.currentItem = material
materialList.currentBrand = material.brand materialList.currentBrand = material.brand
materialList.currentType = material.brand + "_" + material.material materialList.currentType = material.brand + "_" + material.material
base.currentItem = material
} }
hoverEnabled: true hoverEnabled: true
onEntered: { material_slot.hovered = true } onEntered: { material_slot.hovered = true }
@ -128,5 +117,4 @@ Rectangle
source: material_slot.is_favorite ? UM.Theme.getIcon("favorites_star_full") : UM.Theme.getIcon("favorites_star_empty") source: material_slot.is_favorite ? UM.Theme.getIcon("favorites_star_full") : UM.Theme.getIcon("favorites_star_empty")
} }
} }
}
} }