diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 1abab6baaf..6f3d6ffa17 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -70,7 +70,7 @@ Item OldControls.ToolButton { id: printerTypeSelector - text: Cura.MachineManager.activeMachine.definition.name + text: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.definition.name: "" tooltip: text height: UM.Theme.getSize("print_setup_big_item").height width: Math.round(parent.width * 0.7) + UM.Theme.getSize("default_margin").width @@ -201,7 +201,7 @@ Item return paddedWidth - textWidth - UM.Theme.getSize("print_setup_big_item").height * 0.5 - UM.Theme.getSize("default_margin").width } } - property string instructionLink: Cura.ContainerManager.getContainerMetaDataEntry(Cura.MachineManager.activeStack.material.id, "instruction_link", "") + property string instructionLink: Cura.MachineManager.activeStack != null ? Cura.ContainerManager.getContainerMetaDataEntry(Cura.MachineManager.activeStack.material.id, "instruction_link", ""): "" Row { diff --git a/resources/qml/Menus/LocalPrinterMenu.qml b/resources/qml/Menus/LocalPrinterMenu.qml index 4da1de2abf..bd6c57d744 100644 --- a/resources/qml/Menus/LocalPrinterMenu.qml +++ b/resources/qml/Menus/LocalPrinterMenu.qml @@ -15,7 +15,7 @@ Instantiator { text: model.name checkable: true - checked: Cura.MachineManager.activeMachineId == model.id + checked: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id == model.id: false exclusiveGroup: group visible: !model.hasRemoteConnection onTriggered: Cura.MachineManager.setActiveMachine(model.id) diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index 79989d00a1..81630b7548 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -18,7 +18,7 @@ UM.ManagementPage sectionRole: "discoverySource" - activeId: Cura.MachineManager.activeMachineId + activeId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id: "" activeIndex: activeMachineIndex() function activeMachineIndex() diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index b0e225fd8e..f134e006e4 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -271,6 +271,8 @@ Item property var globalPropertyProvider: inheritStackProvider property var externalResetHandler: false + property string activeMachineId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id : "" + //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. @@ -314,16 +316,15 @@ Item when: model.settable_per_extruder || (inheritStackProvider.properties.limit_to_extruder != null && inheritStackProvider.properties.limit_to_extruder >= 0); value: { - // associate this binding with Cura.MachineManager.activeMachineId in the beginning so this + // Associate this binding with Cura.MachineManager.activeMachine.id in the beginning so this // binding will be triggered when activeMachineId is changed too. // Otherwise, if this value only depends on the extruderIds, it won't get updated when the // machine gets changed. - var activeMachineId = Cura.MachineManager.activeMachineId; if (!model.settable_per_extruder) { //Not settable per extruder or there only is global, so we must pick global. - return activeMachineId; + return delegate.activeMachineId } if (inheritStackProvider.properties.limit_to_extruder != null && inheritStackProvider.properties.limit_to_extruder >= 0) { @@ -336,7 +337,7 @@ Item return Cura.ExtruderManager.activeExtruderStackId; } //No extruder tab is selected. Pick the global stack. Shouldn't happen any more since we removed the global tab. - return activeMachineId; + return delegate.activeMachineId } } @@ -345,7 +346,7 @@ Item UM.SettingPropertyProvider { id: inheritStackProvider - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id: "" key: model.key watchedProperties: [ "limit_to_extruder" ] } @@ -354,7 +355,7 @@ Item { id: provider - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: delegate.activeMachineId key: model.key ? model.key : "" watchedProperties: [ "value", "enabled", "state", "validationState", "settable_per_extruder", "resolve" ] storeIndex: 0 @@ -564,7 +565,7 @@ Item { id: machineExtruderCount - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: delegate.activeMachineId key: "machine_extruder_count" watchedProperties: [ "value" ] storeIndex: 0