From 4b6f4af44eeef9b0d39c3161d7e577d66d57388c Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 11 Dec 2018 11:10:45 +0100 Subject: [PATCH] Close the expandable panel when it becomes disabled It happens when it's open and the user loads a GCode. Contributes to CURA-5941 --- resources/qml/ExpandableComponent.qml | 18 +++++++++++++++++- resources/qml/ExpandablePopup.qml | 15 ++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 2b07aa7d37..afe15bcb1d 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -88,7 +88,23 @@ Item { target: background property: "color" - value: enabled ? (expanded ? headerActiveColor : headerBackgroundColor) : UM.Theme.getColor("disabled") + value: + { + return base.enabled ? (expanded ? headerActiveColor : headerBackgroundColor) : UM.Theme.getColor("disabled") + } + } + + // The panel needs to close when it becomes disabled + Connections + { + target: base + onEnabledChanged: + { + if (!base.enabled && expanded) + { + toggleContent() + } + } } implicitHeight: 100 * screenScaleFactor diff --git a/resources/qml/ExpandablePopup.qml b/resources/qml/ExpandablePopup.qml index 4bf1684f18..2d2665373e 100644 --- a/resources/qml/ExpandablePopup.qml +++ b/resources/qml/ExpandablePopup.qml @@ -94,7 +94,20 @@ Item { target: background property: "color" - value: enabled ? headerBackgroundColor : UM.Theme.getColor("disabled") + value: base.enabled ? headerBackgroundColor : UM.Theme.getColor("disabled") + } + + // The panel needs to close when it becomes disabled + Connections + { + target: base + onEnabledChanged: + { + if (!base.enabled && expanded) + { + toggleContent() + } + } } implicitHeight: 100 * screenScaleFactor