Factor out superfluous use of small_tool_button style

The style was overly complicated for what it should do
This commit is contained in:
Jaime van Kessel 2018-11-26 17:40:34 +01:00
parent a3b45ff203
commit 5ddb3ff909
2 changed files with 8 additions and 115 deletions

View file

@ -436,118 +436,6 @@ QtObject
}
}
property Component small_tool_button: Component
{
ButtonStyle
{
background: Item
{
implicitWidth: Theme.getSize("small_button").width;
implicitHeight: Theme.getSize("small_button").height;
Rectangle
{
id: smallButtonFace;
anchors.fill: parent;
property bool down: control.pressed || (control.checkable && control.checked);
color:
{
if(control.customColor !== undefined && control.customColor !== null)
{
return control.customColor
}
else if(control.checkable && control.checked && control.hovered)
{
return Theme.getColor("small_button_active_hover");
}
else if(control.pressed || (control.checkable && control.checked))
{
return Theme.getColor("small_button_active");
}
else if(control.hovered)
{
return Theme.getColor("small_button_hover");
}
else
{
return Theme.getColor("small_button");
}
}
Behavior on color { ColorAnimation { duration: 50; } }
border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0
border.color: Theme.getColor("tool_button_border")
UM.RecolorImage
{
id: smallToolButtonArrow
width: 5
height: 5
sourceSize.width: 5
sourceSize.height: 5
visible: control.menu != null;
color:
{
if(control.checkable && control.checked && control.hovered)
{
return Theme.getColor("small_button_text_active_hover");
}
else if(control.pressed || (control.checkable && control.checked))
{
return Theme.getColor("small_button_text_active");
}
else if(control.hovered)
{
return Theme.getColor("small_button_text_hover");
}
else
{
return Theme.getColor("small_button_text");
}
}
source: Theme.getIcon("arrow_bottom")
}
}
}
label: Item
{
UM.RecolorImage
{
anchors.centerIn: parent
opacity: !control.enabled ? 0.2 : 1.0
source: control.iconSource;
width: Theme.getSize("small_button_icon").width
height: Theme.getSize("small_button_icon").height
color:
{
if(control.checkable && control.checked && control.hovered)
{
return Theme.getColor("small_button_text_active_hover");
}
else if(control.pressed || (control.checkable && control.checked))
{
return Theme.getColor("small_button_text_active");
}
else if(control.hovered)
{
return Theme.getColor("small_button_text_hover");
}
else
{
return Theme.getColor("small_button_text");
}
}
sourceSize: Theme.getSize("small_button_icon")
}
}
}
}
property Component progressbar: Component
{
ProgressBarStyle