Fix QML warnings

This commit is contained in:
Lipu Fei 2018-03-14 11:05:32 +01:00
parent 8efc3b8b5d
commit f5f8bf19ec
2 changed files with 7 additions and 2 deletions

View File

@ -347,7 +347,8 @@ Column
id: materialSelection id: materialSelection
property var activeExtruder: Cura.MachineManager.activeStack property var activeExtruder: Cura.MachineManager.activeStack
property var currentRootMaterialName: activeExtruder.material.name property var hasActiveExtruder: activeExtruder != null
property var currentRootMaterialName: hasActiveExtruder ? activeExtruder.material.name : ""
text: currentRootMaterialName text: currentRootMaterialName
tooltip: currentRootMaterialName tooltip: currentRootMaterialName
@ -366,6 +367,10 @@ Column
property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported
function isMaterialSupported () { function isMaterialSupported () {
if (!hasActiveExtruder)
{
return false;
}
return Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible") == "True" return Cura.ContainerManager.getContainerMetaDataEntry(activeExtruder.material.id, "compatible") == "True"
} }
} }

View File

@ -101,7 +101,7 @@ UM.Dialog
} }
Label Label
{ {
text: Cura.MachineManager.activeMachine.definition.name text: (Cura.MachineManager.activeMachine == null) ? "" : Cura.MachineManager.activeMachine.definition.name
width: (parent.width / 3) | 0 width: (parent.width / 3) | 0
} }
} }