From 14429d81ccfe03adafe8ebc151d77170cafa3313 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Fri, 22 Sep 2017 14:31:19 +0200 Subject: [PATCH] CURA-4313 fix re-binding checkboxes after manually clicking them --- resources/qml/Cura.qml | 1 + resources/qml/Topbar.qml | 39 +++++++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 5877656acc..9a0a84b39e 100755 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -24,6 +24,7 @@ UM.MainWindow { target: Printer onShowPrintMonitor: { + console.log("show", show) if (show) { topbar.startMonitoringPrint() } else { diff --git a/resources/qml/Topbar.qml b/resources/qml/Topbar.qml index 5e208a40b4..24ffe4252e 100644 --- a/resources/qml/Topbar.qml +++ b/resources/qml/Topbar.qml @@ -71,15 +71,23 @@ Rectangle { id: showSettings height: UM.Theme.getSize("sidebar_header").height - onClicked: base.stopMonitoringPrint() - property color overlayColor: "transparent" - property string overlayIconSource: "" text: catalog.i18nc("@title:tab", "Prepare") checkable: true - checked: !base.monitoringPrint + checked: isChecked() exclusiveGroup: sidebarHeaderBarGroup - style: UM.Theme.styles.topbar_header_tab + + onClicked: { + base.stopMonitoringPrint() + checked = Qt.binding(isChecked) + } + + function isChecked () { + return !base.monitoringPrint + } + + property color overlayColor: "transparent" + property string overlayIconSource: "" } Button @@ -87,8 +95,21 @@ Rectangle id: showMonitor width: UM.Theme.getSize("topbar_button").width height: UM.Theme.getSize("sidebar_header").height - onClicked: base.startMonitoringPrint() text: catalog.i18nc("@title:tab", "Monitor") + checkable: true + checked: isChecked() + exclusiveGroup: sidebarHeaderBarGroup + style: UM.Theme.styles.topbar_header_tab_no_overlay + + onClicked: { + base.startMonitoringPrint() + checked = Qt.binding(isChecked) + } + + function isChecked () { + return base.monitoringPrint + } + property string iconSource: { if (!printerConnected) @@ -125,12 +146,6 @@ Rectangle return UM.Theme.getIcon("tab_status_unknown") } } - - checkable: true - checked: base.monitoringPrint - exclusiveGroup: sidebarHeaderBarGroup - - style: UM.Theme.styles.topbar_header_tab_no_overlay } ExclusiveGroup { id: sidebarHeaderBarGroup }