Fix QML warnings

This commit is contained in:
Lipu Fei 2020-01-07 10:57:29 +01:00
parent 045f4c51fa
commit 4f91389941
5 changed files with 26 additions and 8 deletions

View file

@ -88,7 +88,7 @@ Window
right: parent.right
}
textArea.text: manager.getExampleData()
textArea.text: (manager === null) ? "" : manager.getExampleData()
textArea.textFormat: Text.RichText
textArea.wrapMode: Text.Wrap
textArea.readOnly: true

View file

@ -14,7 +14,7 @@ Item
id: base
property bool activity: CuraApplication.platformActivity
property string fileBaseName: PrintInformation.baseName
property string fileBaseName: (PrintInformation === null) ? "" : PrintInformation.baseName
UM.I18nCatalog
{
@ -80,7 +80,7 @@ Item
height: UM.Theme.getSize("jobspecs_line").height
width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50)
maximumLength: 120
text: PrintInformation.jobName
text: (PrintInformation === null) ? "" : PrintInformation.jobName
horizontalAlignment: TextInput.AlignLeft
property string textBeforeEdit: ""

View file

@ -13,11 +13,19 @@ Menu
title: catalog.i18nc("@label:category menu label", "Material")
property int extruderIndex: 0
property string currentRootMaterialId: Cura.MachineManager.currentRootMaterialId[extruderIndex]
property var activeExtruder: Cura.MachineManager.activeMachine.extruderList[extruderIndex]
property bool isActiveExtruderEnabled: activeExtruder === undefined ? false : activeExtruder.isEnabled
property string currentRootMaterialId:
{
var value = Cura.MachineManager.currentRootMaterialId[extruderIndex]
return (value === undefined) ? "" : value
}
property var activeExtruder:
{
var activeMachine = Cura.MachineManager.activeMachine
return (activeMachine === null) ? null : activeMachine.extruderList[extruderIndex]
}
property bool isActiveExtruderEnabled: activeExtruder === null ? false : activeExtruder.isEnabled
property string activeMaterialId: activeExtruder === undefined ? false : activeExtruder.material.id
property string activeMaterialId: activeExtruder === null ? false : activeExtruder.material.id
property bool updateModels: true
Cura.FavoriteMaterialsModel

View file

@ -28,12 +28,22 @@ Menu
text: model.hotend_name
checkable: true
checked: {
var activeMachine = Cura.MachineManager.activeMachine
if (activeMachine === null)
{
return false
}
var extruder = Cura.MachineManager.activeMachine.extruderList[extruderIndex]
return (extruder === undefined) ? false : (extruder.variant.name == model.hotend_name)
}
exclusiveGroup: group
enabled:
{
var activeMachine = Cura.MachineManager.activeMachine
if (activeMachine === null)
{
return false
}
var extruder = Cura.MachineManager.activeMachine.extruderList[extruderIndex]
return (extruder === undefined) ? false : extruder.isEnabled
}

View file

@ -22,7 +22,7 @@ Menu
Menu
{
title: modelData.name
property var extruder: Cura.MachineManager.activeMachine.extruderList[model.index]
property var extruder: (base.activeMachine === null) ? null : activeMachine.extruderList[model.index]
NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.activeMachine.hasVariants; extruderIndex: index }
MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.activeMachine.hasMaterials; extruderIndex: index }