Fix crash when materialManager could not be converted to QObject

No idea why this was causing issues, but this should also be a bit faster.

CURA-6600
This commit is contained in:
Jaime van Kessel 2019-08-19 12:47:07 +02:00
parent 2417705dfd
commit 8759aae73e

View File

@ -17,6 +17,8 @@ Item
property var resetEnabled: false
property var currentItem: null
property var materialManager: CuraApplication.getMaterialManager()
property var hasCurrentItem: base.currentItem != null
property var isCurrentItemActivated:
{
@ -119,7 +121,7 @@ Item
onClicked:
{
forceActiveFocus();
base.newRootMaterialIdToSwitchTo = CuraApplication.getMaterialManager().createMaterial();
base.newRootMaterialIdToSwitchTo = base.materialManager.createMaterial();
base.toActivateNewMaterial = true;
}
}
@ -134,7 +136,7 @@ Item
onClicked:
{
forceActiveFocus();
base.newRootMaterialIdToSwitchTo = CuraApplication.getMaterialManager().duplicateMaterial(base.currentItem.container_node);
base.newRootMaterialIdToSwitchTo = base.materialManager.duplicateMaterial(base.currentItem.container_node);
base.toActivateNewMaterial = true;
}
}
@ -145,7 +147,8 @@ Item
id: removeMenuButton
text: catalog.i18nc("@action:button", "Remove")
iconName: "list-remove"
enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated && CuraApplication.getMaterialManager().canMaterialBeRemoved(base.currentItem.container_node)
enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated && base.materialManager.canMaterialBeRemoved(base.currentItem.container_node)
onClicked:
{
forceActiveFocus();
@ -294,7 +297,7 @@ Item
{
// Set the active material as the fallback. It will be selected when the current material is deleted
base.newRootMaterialIdToSwitchTo = base.active_root_material_id
CuraApplication.getMaterialManager().removeMaterial(base.currentItem.container_node);
base.materialManager.removeMaterial(base.currentItem.container_node);
}
}