mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-20 21:27:50 -06:00
Fix QML null warnings
This commit is contained in:
parent
958f1a855c
commit
15f4d1231b
2 changed files with 24 additions and 8 deletions
|
@ -16,6 +16,10 @@ Button
|
||||||
|
|
||||||
property bool isValidMaterial:
|
property bool isValidMaterial:
|
||||||
{
|
{
|
||||||
|
if (configuration === null)
|
||||||
|
{
|
||||||
|
return false
|
||||||
|
}
|
||||||
var extruderConfigurations = configuration.extruderConfigurations
|
var extruderConfigurations = configuration.extruderConfigurations
|
||||||
|
|
||||||
for (var index in extruderConfigurations)
|
for (var index in extruderConfigurations)
|
||||||
|
@ -62,11 +66,11 @@ Button
|
||||||
Repeater
|
Repeater
|
||||||
{
|
{
|
||||||
id: repeater
|
id: repeater
|
||||||
model: configuration.extruderConfigurations
|
model: configuration !== null ? configuration.extruderConfigurations: null
|
||||||
width: parent.width
|
width: parent.width
|
||||||
delegate: PrintCoreConfiguration
|
delegate: PrintCoreConfiguration
|
||||||
{
|
{
|
||||||
width: Math.round(parent.width / configuration.extruderConfigurations.length)
|
width: Math.round(parent.width / (configuration !== null ? configuration.extruderConfigurations.length : 1))
|
||||||
printCoreConfiguration: modelData
|
printCoreConfiguration: modelData
|
||||||
visible: configurationItem.isValidMaterial
|
visible: configurationItem.isValidMaterial
|
||||||
}
|
}
|
||||||
|
@ -100,6 +104,11 @@ Button
|
||||||
id: unknownMaterialMessage
|
id: unknownMaterialMessage
|
||||||
text:
|
text:
|
||||||
{
|
{
|
||||||
|
if (configuration === null)
|
||||||
|
{
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var extruderConfigurations = configuration.extruderConfigurations
|
var extruderConfigurations = configuration.extruderConfigurations
|
||||||
var unknownMaterials = []
|
var unknownMaterials = []
|
||||||
for (var index in extruderConfigurations)
|
for (var index in extruderConfigurations)
|
||||||
|
@ -194,7 +203,14 @@ Button
|
||||||
{
|
{
|
||||||
id: buildplateLabel
|
id: buildplateLabel
|
||||||
source: UM.Theme.getIcon("buildplate")
|
source: UM.Theme.getIcon("buildplate")
|
||||||
text: configuration.buildplateConfiguration.charAt(0).toUpperCase() + configuration.buildplateConfiguration.substr(1)
|
text:
|
||||||
|
{
|
||||||
|
if (configuration === null)
|
||||||
|
{
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return configuration.buildplateConfiguration.charAt(0).toUpperCase() + configuration.buildplateConfiguration.substr(1)
|
||||||
|
}
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,9 @@ Item
|
||||||
Cura.ExtruderIcon
|
Cura.ExtruderIcon
|
||||||
{
|
{
|
||||||
id: icon
|
id: icon
|
||||||
materialColor: printCoreConfiguration.material.color
|
materialColor: printCoreConfiguration !== null ? printCoreConfiguration.material.color : ""
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
extruderEnabled: printCoreConfiguration.material.brand !== "" && printCoreConfiguration.hotendID !== ""
|
extruderEnabled: printCoreConfiguration !== null && printCoreConfiguration.material.brand !== "" && printCoreConfiguration.hotendID !== ""
|
||||||
}
|
}
|
||||||
|
|
||||||
Column
|
Column
|
||||||
|
@ -35,7 +35,7 @@ Item
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: printCoreConfiguration.material.brand ? printCoreConfiguration.material.brand : " " //Use space so that the height is still correct.
|
text: (printCoreConfiguration !== null && printCoreConfiguration.material.brand) ? printCoreConfiguration.material.brand : " " //Use space so that the height is still correct.
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
|
@ -44,7 +44,7 @@ Item
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: printCoreConfiguration.material.brand ? printCoreConfiguration.material.name : " " //Use space so that the height is still correct.
|
text: (printCoreConfiguration !== null && printCoreConfiguration.material.brand) ? printCoreConfiguration.material.name : " " //Use space so that the height is still correct.
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font: UM.Theme.getFont("medium")
|
font: UM.Theme.getFont("medium")
|
||||||
|
@ -53,7 +53,7 @@ Item
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: printCoreConfiguration.hotendID ? printCoreConfiguration.hotendID : " " //Use space so that the height is still correct.
|
text: (printCoreConfiguration !== null && printCoreConfiguration.hotendID) ? printCoreConfiguration.hotendID : " " //Use space so that the height is still correct.
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue