Fix a couple of qml casting errors

This commit is contained in:
fieldOfView 2016-08-01 15:22:21 +02:00
parent a9ed562a58
commit 0c8d0a11a9
3 changed files with 6 additions and 4 deletions

View File

@ -16,6 +16,7 @@ UM.Dialog
{
id: base
title: catalog.i18nc("@title:window", "Add Printer")
property bool firstRun: false
property string preferredCategory: "Ultimaker"
property string activeCategory: preferredCategory
@ -32,7 +33,7 @@ UM.Dialog
signal machineAdded(string id)
function getMachineName()
{
var name = machineList.model.get(machineList.currentIndex).name
var name = machineList.model.get(machineList.currentIndex) != undefined ? machineList.model.get(machineList.currentIndex).name : ""
return name
}

View File

@ -677,6 +677,7 @@ UM.MainWindow
id: addMachineDialog
onMachineAdded:
{
machineActionsWizard.firstRun = addMachineDialog.firstRun
machineActionsWizard.start(id)
}
}

View File

@ -83,7 +83,7 @@ UM.ManagementPage
Repeater
{
id: machineActionRepeater
model: Cura.MachineActionManager.getSupportedActions(Cura.MachineManager.getDefinitionByMachineId(base.currentItem.id))
model: base.currentItem ? Cura.MachineActionManager.getSupportedActions(Cura.MachineManager.getDefinitionByMachineId(base.currentItem.id)) : null
Button
{
@ -125,8 +125,8 @@ UM.ManagementPage
spacing: UM.Theme.getSize("default_margin").height
Label { text: catalog.i18nc("@label", "Type") }
Label { text: base.currentItem ? base.currentItem.metadata.definition_name : "" }
Label { text: catalog.i18nc("@label", "Type"); visible: base.currentItem }
Label { text: (base.currentItem && base.currentItem.metadata) ? base.currentItem.metadata.definition_name : "" }
}
UM.I18nCatalog { id: catalog; name: "uranium"; }