Close the expandable panel when it becomes disabled

It happens when it's open and the user loads a GCode.

Contributes to CURA-5941
This commit is contained in:
Diego Prado Gesto 2018-12-11 11:10:45 +01:00
parent 4dab33d41b
commit 4b6f4af44e
2 changed files with 31 additions and 2 deletions

View file

@ -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

View file

@ -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