mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-12-02 15:21:15 -07:00
Turn MaterialManagementModel into a singleton
Just like MaterialManager used to be. There can be only one instance of the page then. This prevents a crash when Qt deletes the QObject because it's no longer used in the page when you close the preferences screen. But when you open it again it doesn't construct a new one. Now there is always one instance so that's not a problem any more. Also it allows other pages to access this item. Contributes to issue CURA-6600.
This commit is contained in:
parent
b60b13e5bf
commit
8346e465f6
3 changed files with 11 additions and 9 deletions
|
|
@ -23,6 +23,7 @@ TabView
|
|||
property real secondColumnWidth: (width * 0.40) | 0
|
||||
property string containerId: ""
|
||||
property var materialPreferenceValues: UM.Preferences.getValue("cura/material_settings") ? JSON.parse(UM.Preferences.getValue("cura/material_settings")) : {}
|
||||
property var materialManagementModel: CuraApplication.getMaterialManagementModel()
|
||||
|
||||
property double spoolLength: calculateSpoolLength()
|
||||
property real costPerMeter: calculateCostPerMeter()
|
||||
|
|
@ -565,7 +566,7 @@ TabView
|
|||
}
|
||||
|
||||
// update the values
|
||||
materialManagement.setMaterialName(base.currentMaterialNode, new_name)
|
||||
base.materialManagementModel.setMaterialName(base.currentMaterialNode, new_name)
|
||||
properties.name = new_name
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue