mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Move MonitorButtonStyle to styles.qml
CURA-5943
This commit is contained in:
parent
845b320981
commit
6bb010e74a
3 changed files with 88 additions and 101 deletions
|
@ -21,11 +21,6 @@ Item
|
||||||
implicitWidth: parent.width
|
implicitWidth: parent.width
|
||||||
implicitHeight: childrenRect.height
|
implicitHeight: childrenRect.height
|
||||||
|
|
||||||
MonitorButtonStyle
|
|
||||||
{
|
|
||||||
id: monitorButtonStyle
|
|
||||||
}
|
|
||||||
|
|
||||||
Column
|
Column
|
||||||
{
|
{
|
||||||
enabled:
|
enabled:
|
||||||
|
@ -108,7 +103,7 @@ Item
|
||||||
Layout.preferredWidth: width
|
Layout.preferredWidth: width
|
||||||
Layout.preferredHeight: height
|
Layout.preferredHeight: height
|
||||||
iconSource: UM.Theme.getIcon("arrow_top");
|
iconSource: UM.Theme.getIcon("arrow_top");
|
||||||
style: monitorButtonStyle
|
style: UM.Theme.styles.monitor_button_style
|
||||||
width: height
|
width: height
|
||||||
height: UM.Theme.getSize("setting_control").height
|
height: UM.Theme.getSize("setting_control").height
|
||||||
|
|
||||||
|
@ -125,7 +120,7 @@ Item
|
||||||
Layout.preferredWidth: width
|
Layout.preferredWidth: width
|
||||||
Layout.preferredHeight: height
|
Layout.preferredHeight: height
|
||||||
iconSource: UM.Theme.getIcon("arrow_left");
|
iconSource: UM.Theme.getIcon("arrow_left");
|
||||||
style: monitorButtonStyle
|
style: UM.Theme.styles.monitor_button_style
|
||||||
width: height
|
width: height
|
||||||
height: UM.Theme.getSize("setting_control").height
|
height: UM.Theme.getSize("setting_control").height
|
||||||
|
|
||||||
|
@ -142,7 +137,7 @@ Item
|
||||||
Layout.preferredWidth: width
|
Layout.preferredWidth: width
|
||||||
Layout.preferredHeight: height
|
Layout.preferredHeight: height
|
||||||
iconSource: UM.Theme.getIcon("arrow_right");
|
iconSource: UM.Theme.getIcon("arrow_right");
|
||||||
style: monitorButtonStyle
|
style: UM.Theme.styles.monitor_button_style
|
||||||
width: height
|
width: height
|
||||||
height: UM.Theme.getSize("setting_control").height
|
height: UM.Theme.getSize("setting_control").height
|
||||||
|
|
||||||
|
@ -159,7 +154,7 @@ Item
|
||||||
Layout.preferredWidth: width
|
Layout.preferredWidth: width
|
||||||
Layout.preferredHeight: height
|
Layout.preferredHeight: height
|
||||||
iconSource: UM.Theme.getIcon("arrow_bottom");
|
iconSource: UM.Theme.getIcon("arrow_bottom");
|
||||||
style: monitorButtonStyle
|
style: UM.Theme.styles.monitor_button_style
|
||||||
width: height
|
width: height
|
||||||
height: UM.Theme.getSize("setting_control").height
|
height: UM.Theme.getSize("setting_control").height
|
||||||
|
|
||||||
|
@ -176,7 +171,7 @@ Item
|
||||||
Layout.preferredWidth: width
|
Layout.preferredWidth: width
|
||||||
Layout.preferredHeight: height
|
Layout.preferredHeight: height
|
||||||
iconSource: UM.Theme.getIcon("home");
|
iconSource: UM.Theme.getIcon("home");
|
||||||
style: monitorButtonStyle
|
style: UM.Theme.styles.monitor_button_style
|
||||||
width: height
|
width: height
|
||||||
height: UM.Theme.getSize("setting_control").height
|
height: UM.Theme.getSize("setting_control").height
|
||||||
|
|
||||||
|
@ -206,7 +201,7 @@ Item
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
iconSource: UM.Theme.getIcon("arrow_top");
|
iconSource: UM.Theme.getIcon("arrow_top");
|
||||||
style: monitorButtonStyle
|
style: UM.Theme.styles.monitor_button_style
|
||||||
width: height
|
width: height
|
||||||
height: UM.Theme.getSize("setting_control").height
|
height: UM.Theme.getSize("setting_control").height
|
||||||
|
|
||||||
|
@ -219,7 +214,7 @@ Item
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
iconSource: UM.Theme.getIcon("home");
|
iconSource: UM.Theme.getIcon("home");
|
||||||
style: monitorButtonStyle
|
style: UM.Theme.styles.monitor_button_style
|
||||||
width: height
|
width: height
|
||||||
height: UM.Theme.getSize("setting_control").height
|
height: UM.Theme.getSize("setting_control").height
|
||||||
|
|
||||||
|
@ -232,7 +227,7 @@ Item
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
iconSource: UM.Theme.getIcon("arrow_bottom");
|
iconSource: UM.Theme.getIcon("arrow_bottom");
|
||||||
style: monitorButtonStyle
|
style: UM.Theme.styles.monitor_button_style
|
||||||
width: height
|
width: height
|
||||||
height: UM.Theme.getSize("setting_control").height
|
height: UM.Theme.getSize("setting_control").height
|
||||||
|
|
||||||
|
|
|
@ -1,88 +0,0 @@
|
||||||
import QtQuick 2.10
|
|
||||||
import QtQuick.Controls 1.4
|
|
||||||
import QtQuick.Controls.Styles 1.4
|
|
||||||
import QtQuick.Layouts 1.3
|
|
||||||
|
|
||||||
import UM 1.2 as UM
|
|
||||||
import Cura 1.0 as Cura
|
|
||||||
|
|
||||||
|
|
||||||
Component
|
|
||||||
{
|
|
||||||
ButtonStyle
|
|
||||||
{
|
|
||||||
background: Rectangle
|
|
||||||
{
|
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
|
||||||
border.color:
|
|
||||||
{
|
|
||||||
if(!control.enabled)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("action_button_disabled_border");
|
|
||||||
}
|
|
||||||
else if(control.pressed)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("action_button_active_border");
|
|
||||||
}
|
|
||||||
else if(control.hovered)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("action_button_hovered_border");
|
|
||||||
}
|
|
||||||
return UM.Theme.getColor("action_button_border");
|
|
||||||
}
|
|
||||||
color:
|
|
||||||
{
|
|
||||||
if(!control.enabled)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("action_button_disabled");
|
|
||||||
}
|
|
||||||
else if(control.pressed)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("action_button_active");
|
|
||||||
}
|
|
||||||
else if(control.hovered)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("action_button_hovered");
|
|
||||||
}
|
|
||||||
return UM.Theme.getColor("action_button");
|
|
||||||
}
|
|
||||||
Behavior on color
|
|
||||||
{
|
|
||||||
ColorAnimation
|
|
||||||
{
|
|
||||||
duration: 50
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
label: Item
|
|
||||||
{
|
|
||||||
UM.RecolorImage
|
|
||||||
{
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
width: Math.floor(control.width / 2)
|
|
||||||
height: Math.floor(control.height / 2)
|
|
||||||
sourceSize.width: width
|
|
||||||
sourceSize.height: width
|
|
||||||
color:
|
|
||||||
{
|
|
||||||
if(!control.enabled)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("action_button_disabled_text");
|
|
||||||
}
|
|
||||||
else if(control.pressed)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("action_button_active_text");
|
|
||||||
}
|
|
||||||
else if(control.hovered)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("action_button_hovered_text");
|
|
||||||
}
|
|
||||||
return UM.Theme.getColor("action_button_text");
|
|
||||||
}
|
|
||||||
source: control.iconSource
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1200,4 +1200,84 @@ QtObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property Component monitor_button_style: Component
|
||||||
|
{
|
||||||
|
ButtonStyle
|
||||||
|
{
|
||||||
|
background: Rectangle
|
||||||
|
{
|
||||||
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
|
border.color:
|
||||||
|
{
|
||||||
|
if(!control.enabled)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_disabled_border");
|
||||||
|
}
|
||||||
|
else if(control.pressed)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_active_border");
|
||||||
|
}
|
||||||
|
else if(control.hovered)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_hovered_border");
|
||||||
|
}
|
||||||
|
return UM.Theme.getColor("action_button_border");
|
||||||
|
}
|
||||||
|
color:
|
||||||
|
{
|
||||||
|
if(!control.enabled)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_disabled");
|
||||||
|
}
|
||||||
|
else if(control.pressed)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_active");
|
||||||
|
}
|
||||||
|
else if(control.hovered)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_hovered");
|
||||||
|
}
|
||||||
|
return UM.Theme.getColor("action_button");
|
||||||
|
}
|
||||||
|
Behavior on color
|
||||||
|
{
|
||||||
|
ColorAnimation
|
||||||
|
{
|
||||||
|
duration: 50
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
label: Item
|
||||||
|
{
|
||||||
|
UM.RecolorImage
|
||||||
|
{
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
width: Math.floor(control.width / 2)
|
||||||
|
height: Math.floor(control.height / 2)
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: width
|
||||||
|
color:
|
||||||
|
{
|
||||||
|
if(!control.enabled)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_disabled_text");
|
||||||
|
}
|
||||||
|
else if(control.pressed)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_active_text");
|
||||||
|
}
|
||||||
|
else if(control.hovered)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_hovered_text");
|
||||||
|
}
|
||||||
|
return UM.Theme.getColor("action_button_text");
|
||||||
|
}
|
||||||
|
source: control.iconSource
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue