CURA-4313 fix re-binding checkboxes after manually clicking them

This commit is contained in:
ChrisTerBeke 2017-09-22 14:31:19 +02:00
parent 07161f5d50
commit 14429d81cc
2 changed files with 28 additions and 12 deletions

View File

@ -24,6 +24,7 @@ UM.MainWindow
{ {
target: Printer target: Printer
onShowPrintMonitor: { onShowPrintMonitor: {
console.log("show", show)
if (show) { if (show) {
topbar.startMonitoringPrint() topbar.startMonitoringPrint()
} else { } else {

View File

@ -71,15 +71,23 @@ Rectangle
{ {
id: showSettings id: showSettings
height: UM.Theme.getSize("sidebar_header").height height: UM.Theme.getSize("sidebar_header").height
onClicked: base.stopMonitoringPrint()
property color overlayColor: "transparent"
property string overlayIconSource: ""
text: catalog.i18nc("@title:tab", "Prepare") text: catalog.i18nc("@title:tab", "Prepare")
checkable: true checkable: true
checked: !base.monitoringPrint checked: isChecked()
exclusiveGroup: sidebarHeaderBarGroup exclusiveGroup: sidebarHeaderBarGroup
style: UM.Theme.styles.topbar_header_tab 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 Button
@ -87,8 +95,21 @@ Rectangle
id: showMonitor id: showMonitor
width: UM.Theme.getSize("topbar_button").width width: UM.Theme.getSize("topbar_button").width
height: UM.Theme.getSize("sidebar_header").height height: UM.Theme.getSize("sidebar_header").height
onClicked: base.startMonitoringPrint()
text: catalog.i18nc("@title:tab", "Monitor") 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: property string iconSource:
{ {
if (!printerConnected) if (!printerConnected)
@ -125,12 +146,6 @@ Rectangle
return UM.Theme.getIcon("tab_status_unknown") 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 } ExclusiveGroup { id: sidebarHeaderBarGroup }