From 9e4fcd820eaf67cf431c2e2fe9a3957d6c14d4f9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 12 Oct 2018 14:56:27 +0200 Subject: [PATCH] Update outputDevice when the global container changed And directly link the active printer name to it, so that that also gets updated. With the property var it just gets evaluated upon creating the rectangle. Contributes to issue CURA-5749. --- resources/qml/PrintMonitor.qml | 2 +- resources/qml/PrinterOutput/OutputDeviceHeader.qml | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 3bfcea7025..12e95d1e89 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -44,7 +44,7 @@ Column Repeater { id: extrudersRepeater - model: activePrinter!=null ? activePrinter.extruders : null + model: activePrinter != null ? activePrinter.extruders : null ExtruderBox { diff --git a/resources/qml/PrinterOutput/OutputDeviceHeader.qml b/resources/qml/PrinterOutput/OutputDeviceHeader.qml index 03e6d78699..b5ed1b7b4e 100644 --- a/resources/qml/PrinterOutput/OutputDeviceHeader.qml +++ b/resources/qml/PrinterOutput/OutputDeviceHeader.qml @@ -14,11 +14,19 @@ Item implicitHeight: Math.floor(childrenRect.height + UM.Theme.getSize("default_margin").height * 2) property var outputDevice: null + Connections + { + target: Cura.MachineManager + onGlobalContainerChanged: + { + outputDevice = Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null; + } + } + Rectangle { height: childrenRect.height color: UM.Theme.getColor("setting_category") - property var activePrinter: outputDevice != null ? outputDevice.activePrinter : null Label { @@ -28,7 +36,7 @@ Item anchors.left: parent.left anchors.top: parent.top anchors.margins: UM.Theme.getSize("default_margin").width - text: outputDevice != null ? activePrinter.name : "" + text: outputDevice != null ? outputDevice.activePrinter.name : "" } Label