mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-17 11:47:50 -06:00
Use states to set border&background color in print setup header button
CURA-8684
This commit is contained in:
parent
a66275ce73
commit
a2d03af2f1
1 changed files with 59 additions and 44 deletions
|
@ -20,59 +20,74 @@ ToolButton
|
||||||
targetPoint: Qt.point(parent.x, Math.round(parent.y + parent.height / 2))
|
targetPoint: Qt.point(parent.x, Math.round(parent.y + parent.height / 2))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
states:
|
||||||
|
[
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "disabled"
|
||||||
|
when: !base.enabled;
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: background
|
||||||
|
color: UM.Theme.getColor("setting_control_disabled")
|
||||||
|
border.color: UM.Theme.getColor("setting_control_disabled_border")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "value_error"
|
||||||
|
when: base.enabled && base.valueError
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: background
|
||||||
|
color: UM.Theme.getColor("setting_validation_error_background")
|
||||||
|
border.color: UM.Theme.getColor("setting_validation_error")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "value_warning"
|
||||||
|
when: base.enabled && base.valueWarning
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: background
|
||||||
|
color: UM.Theme.getColor("setting_validation_warning_background")
|
||||||
|
border.color: UM.Theme.getColor("setting_validation_warning")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "highlight"
|
||||||
|
when: base.enabled && base.hovered
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: background
|
||||||
|
color: UM.Theme.getColor("setting_control")
|
||||||
|
border.color: UM.Theme.getColor("setting_control_border_highlight")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "neutral"
|
||||||
|
when: base.enabled && !base.hovered && !base.valueWarning && !base.valueError
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: background
|
||||||
|
color: UM.Theme.getColor("setting_control")
|
||||||
|
border.color: UM.Theme.getColor("setting_control_border")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
background: Rectangle
|
background: Rectangle
|
||||||
{
|
{
|
||||||
color:
|
id: background
|
||||||
{
|
|
||||||
if(base.enabled)
|
|
||||||
{
|
|
||||||
if(base.valueError)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_validation_error_background");
|
|
||||||
}
|
|
||||||
else if(base.valueWarning)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_validation_warning_background");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_control");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_control_disabled");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
radius: UM.Theme.getSize("setting_control_radius").width
|
radius: UM.Theme.getSize("setting_control_radius").width
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color:
|
color: UM.Theme.getColor("setting_control")
|
||||||
{
|
border.color: UM.Theme.getColor("setting_control_border")
|
||||||
if (base.enabled)
|
|
||||||
{
|
|
||||||
if (base.valueError)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_validation_error");
|
|
||||||
}
|
|
||||||
else if (base.valueWarning)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_validation_warning");
|
|
||||||
}
|
|
||||||
else if (base.hovered)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_control_border_highlight");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_control_border");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_control_disabled_border");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
id: downArrow
|
id: downArrow
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue