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

@ -35,6 +35,9 @@ class BaseMaterialsModel(ListModel):
# Update this model when list of materials changes
self._material_manager.materialsUpdated.connect(self._update)
# Update this model when list of favorites changes
self._material_manager.favoritesUpdated.connect(self._update)
self.addRoleName(Qt.UserRole + 1, "root_material_id")
self.addRoleName(Qt.UserRole + 2, "id")
self.addRoleName(Qt.UserRole + 3, "GUID")