Improved expansion behavior

Contributes to CURA-5682

- Active material is now expanded by default when opening the manager

- Expanded and collapsed sections are saved to preferences

- Sections are now highlighted when collapsed and having a selected material inside

- Bug with losing focus between fields is not yet fixed
This commit is contained in:
Ian Paschal 2018-09-05 17:16:06 +02:00
parent f1d2d7ed36
commit 9e56d6d29f
7 changed files with 119 additions and 34 deletions

View file

@ -12,7 +12,8 @@ class MaterialTypesModel(ListModel):
super().__init__(parent)
self.addRoleName(Qt.UserRole + 1, "name")
self.addRoleName(Qt.UserRole + 2, "colors")
self.addRoleName(Qt.UserRole + 2, "brand")
self.addRoleName(Qt.UserRole + 3, "colors")
class MaterialBrandsModel(BaseMaterialsModel):
@ -86,6 +87,7 @@ class MaterialBrandsModel(BaseMaterialsModel):
for material_type, material_list in material_dict.items():
material_type_item = {
"name": material_type,
"brand": brand,
"colors": BaseMaterialsModel(self)
}
material_type_item["colors"].clear()