Expanded states preserved when updating models

Did this so that models can be updated more often fixing bugs where when a material is set as "not favorite" in the favorites section, its updated accordingly in its "normal" section.

It's also the ground work for saving material section expansion to preferences.

Contributes to CURA-5378
This commit is contained in:
Ian Paschal 2018-08-24 12:10:32 +02:00
parent 13069a2f99
commit 2304aeaceb
6 changed files with 74 additions and 28 deletions

View file

@ -13,7 +13,7 @@ import Cura 1.0 as Cura
Rectangle
{
id: brand_section
property var expanded: true
property var expanded: base.collapsed_brands.indexOf(model.name) > -1
property var types_model: model.material_types
height: childrenRect.height
width: parent.width
@ -69,7 +69,19 @@ Rectangle
anchors.fill: brand_header
onPressed:
{
brand_section.expanded = !brand_section.expanded
const i = base.collapsed_brands.indexOf(model.name)
if (i > -1)
{
// Remove it
base.collapsed_brands.splice(i, 1)
brand_section.expanded = false
}
else
{
// Add it
base.collapsed_brands.push(model.name)
brand_section.expanded = true
}
}
}
Column