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

@ -6,7 +6,7 @@ import QtQuick.Controls 1.2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import UM 1.0 as UM import UM 1.4 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Item Item
@ -55,11 +55,16 @@ Item
} }
Button UM.SimpleButton
{ {
id: playButton id: playButton
iconSource: !is_simulation_playing ? "./resources/simulation_resume.svg": "./resources/simulation_pause.svg" iconSource: !is_simulation_playing ? "./resources/simulation_resume.svg": "./resources/simulation_pause.svg"
style: UM.Theme.styles.small_tool_button width: UM.Theme.getSize("small_button").width
height: UM.Theme.getSize("small_button").height
hoverBackgroundColor: UM.Theme.getColor("small_button_hover")
hoverColor: UM.Theme.getColor("small_button_text_hover")
color: UM.Theme.getColor("small_button_text")
iconMargin: 0.5 * UM.Theme.getSize("wide_lining").width
visible: !UM.SimulationView.compatibilityMode visible: !UM.SimulationView.compatibilityMode
Connections Connections

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 property Component progressbar: Component
{ {
ProgressBarStyle ProgressBarStyle