mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-12-11 16:00:47 -07:00
Use ListModel.setItems() instead of appending one item at a time
setItems sets the items to a (presorted) list of items instead of adding items one by one and then sorting the list. This way if an update to the model causes a signal storm at least it happens only once for an update. Specifically this reduces switching to a dual extrusion printer by half. Contributes to CURA-2193
This commit is contained in:
parent
0e602b8d0b
commit
b343649131
3 changed files with 14 additions and 9 deletions
|
|
@ -70,7 +70,7 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
|||
if not self._quality:
|
||||
return
|
||||
|
||||
self.clear()
|
||||
items = []
|
||||
|
||||
settings = collections.OrderedDict()
|
||||
definition_container = UM.Application.getInstance().getGlobalContainerStack().getBottom()
|
||||
|
|
@ -163,7 +163,7 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
|||
if not profile_value and not user_value:
|
||||
continue
|
||||
|
||||
self.appendItem({
|
||||
items.append({
|
||||
"key": definition.key,
|
||||
"label": definition.label,
|
||||
"unit": definition.unit,
|
||||
|
|
@ -171,3 +171,5 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
|||
"user_value": "" if user_value is None else str(user_value),
|
||||
"category": current_category
|
||||
})
|
||||
|
||||
self.setItems(items)
|
||||
Loading…
Add table
Add a link
Reference in a new issue