Replace usage of UM.Theme with Theme from context in Cura theme styles

This way we do not recursively try to create the Theme object
This commit is contained in:
Arjen Hiemstra 2016-02-16 15:22:53 +01:00 committed by Ghostkeeper
parent e378c54ce2
commit 2aaf633492

View File

@ -5,37 +5,37 @@ import QtQuick 2.1
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import UM 1.0 as UM import UM 1.1 as UM
QtObject { QtObject {
property Component sidebar_header_button: Component { property Component sidebar_header_button: Component {
ButtonStyle { ButtonStyle {
background: Rectangle { background: Rectangle {
color: UM.Theme.getColor("setting_control") color: Theme.getColor("setting_control")
border.width: UM.Theme.getSize("default_lining").width border.width: Theme.getSize("default_lining").width
border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border")
UM.RecolorImage { UM.RecolorImage {
id: downArrow id: downArrow
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.rightMargin: Theme.getSize("default_margin").width
width: UM.Theme.getSize("standard_arrow").width width: Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height height: Theme.getSize("standard_arrow").height
sourceSize.width: width sourceSize.width: width
sourceSize.height: width sourceSize.height: width
color: UM.Theme.getColor("setting_category_text") color: Theme.getColor("setting_category_text")
source: UM.Theme.getIcon("arrow_bottom") source: Theme.getIcon("arrow_bottom")
} }
Label { Label {
id: sidebarComboBoxLabel id: sidebarComboBoxLabel
color: UM.Theme.getColor("setting_control_text") color: Theme.getColor("setting_control_text")
text: control.text; text: control.text;
elide: Text.ElideRight; elide: Text.ElideRight;
anchors.left: parent.left; anchors.left: parent.left;
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width anchors.leftMargin: Theme.getSize("setting_unit_margin").width
anchors.right: downArrow.left; anchors.right: downArrow.left;
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter;
font: UM.Theme.getFont("default") font: Theme.getFont("default")
} }
} }
label: Label{} label: Label{}
@ -45,23 +45,23 @@ QtObject {
property Component tool_button: Component { property Component tool_button: Component {
ButtonStyle { ButtonStyle {
background: Item { background: Item {
implicitWidth: UM.Theme.getSize("button").width; implicitWidth: Theme.getSize("button").width;
implicitHeight: UM.Theme.getSize("button").height; implicitHeight: Theme.getSize("button").height;
UM.PointingRectangle { UM.PointingRectangle {
id: button_tooltip id: button_tooltip
anchors.left: parent.right anchors.left: parent.right
anchors.leftMargin: UM.Theme.getSize("button_tooltip_arrow").width * 2 anchors.leftMargin: Theme.getSize("button_tooltip_arrow").width * 2
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
target: Qt.point(parent.x, y + height/2) target: Qt.point(parent.x, y + height/2)
arrowSize: UM.Theme.getSize("button_tooltip_arrow").width arrowSize: Theme.getSize("button_tooltip_arrow").width
color: UM.Theme.getColor("tooltip") color: Theme.getColor("tooltip")
opacity: control.hovered ? 1.0 : 0.0; opacity: control.hovered ? 1.0 : 0.0;
width: control.hovered ? button_tip.width + UM.Theme.getSize("button_tooltip").width : 0 width: control.hovered ? button_tip.width + Theme.getSize("button_tooltip").width : 0
height: UM.Theme.getSize("button_tooltip").height height: Theme.getSize("button_tooltip").height
Behavior on width { NumberAnimation { duration: 100; } } Behavior on width { NumberAnimation { duration: 100; } }
Behavior on opacity { NumberAnimation { duration: 100; } } Behavior on opacity { NumberAnimation { duration: 100; } }
@ -73,8 +73,8 @@ QtObject {
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter;
text: control.text; text: control.text;
font: UM.Theme.getFont("button_tooltip"); font: Theme.getFont("button_tooltip");
color: UM.Theme.getColor("tooltip_text"); color: Theme.getColor("tooltip_text");
} }
} }
@ -86,13 +86,13 @@ QtObject {
color: { color: {
if(control.checkable && control.checked && control.hovered) { if(control.checkable && control.checked && control.hovered) {
return UM.Theme.getColor("button_active_hover"); return Theme.getColor("button_active_hover");
} else if(control.pressed || (control.checkable && control.checked)) { } else if(control.pressed || (control.checkable && control.checked)) {
return UM.Theme.getColor("button_active"); return Theme.getColor("button_active");
} else if(control.hovered) { } else if(control.hovered) {
return UM.Theme.getColor("button_hover"); return Theme.getColor("button_hover");
} else { } else {
return UM.Theme.getColor("button"); return Theme.getColor("button");
} }
} }
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
@ -102,16 +102,16 @@ QtObject {
id: tool_button_arrow id: tool_button_arrow
opacity: !control.enabled ? 0.2 : 1.0 opacity: !control.enabled ? 0.2 : 1.0
anchors.right: parent.right; anchors.right: parent.right;
anchors.rightMargin: (UM.Theme.getSize("button").width - UM.Theme.getSize("button_icon").width) / 4 anchors.rightMargin: (Theme.getSize("button").width - Theme.getSize("button_icon").width) / 4
anchors.bottom: parent.bottom; anchors.bottom: parent.bottom;
anchors.bottomMargin: (UM.Theme.getSize("button").height - UM.Theme.getSize("button_icon").height) / 4 anchors.bottomMargin: (Theme.getSize("button").height - Theme.getSize("button_icon").height) / 4
width: UM.Theme.getSize("standard_arrow").width width: Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height height: Theme.getSize("standard_arrow").height
sourceSize.width: width sourceSize.width: width
sourceSize.height: width sourceSize.height: width
visible: control.menu != null; visible: control.menu != null;
color: UM.Theme.getColor("button_text") color: Theme.getColor("button_text")
source: UM.Theme.getIcon("arrow_bottom") source: Theme.getIcon("arrow_bottom")
} }
} }
} }
@ -121,10 +121,10 @@ QtObject {
anchors.centerIn: parent; anchors.centerIn: parent;
opacity: !control.enabled ? 0.2 : 1.0 opacity: !control.enabled ? 0.2 : 1.0
source: control.iconSource; source: control.iconSource;
width: UM.Theme.getSize("button_icon").width; width: Theme.getSize("button_icon").width;
height: UM.Theme.getSize("button_icon").height; height: Theme.getSize("button_icon").height;
sourceSize: UM.Theme.getSize("button_icon") sourceSize: Theme.getSize("button_icon")
} }
} }
} }
@ -133,24 +133,24 @@ QtObject {
property Component progressbar: Component{ property Component progressbar: Component{
ProgressBarStyle { ProgressBarStyle {
background:Rectangle { background:Rectangle {
implicitWidth: UM.Theme.getSize("message").width - (UM.Theme.getSize("default_margin").width * 2) implicitWidth: Theme.getSize("message").width - (Theme.getSize("default_margin").width * 2)
implicitHeight: UM.Theme.getSize("progressbar").height implicitHeight: Theme.getSize("progressbar").height
radius: UM.Theme.getSize("progressbar_radius").width radius: Theme.getSize("progressbar_radius").width
color: UM.Theme.getColor("progressbar_background") color: Theme.getColor("progressbar_background")
} }
progress: Rectangle { progress: Rectangle {
color: control.indeterminate ? "transparent" : UM.Theme.getColor("progressbar_control") color: control.indeterminate ? "transparent" : Theme.getColor("progressbar_control")
radius: UM.Theme.sizes.progressbar_radius.width radius: Theme.getSize("progressbar_radius").width
Rectangle{ Rectangle{
radius: UM.Theme.getSize("progressbar_radius").width radius: Theme.getSize("progressbar_radius").width
color: UM.Theme.getColor("progressbar_control") color: Theme.getColor("progressbar_control")
width: UM.Theme.getSize("progressbar_control").width width: Theme.getSize("progressbar_control").width
height: UM.Theme.getSize("progressbar_control").height height: Theme.getSize("progressbar_control").height
visible: control.indeterminate visible: control.indeterminate
SequentialAnimation on x { SequentialAnimation on x {
id: xAnim id: xAnim
property int animEndPoint: UM.Theme.getSize("message").width - (UM.Theme.getSize("default_margin").width * 2) - UM.Theme.getSize("progressbar_control").width property int animEndPoint: Theme.getSize("message").width - (Theme.getSize("default_margin").width * 2) - Theme.getSize("progressbar_control").width
running: control.indeterminate running: control.indeterminate
loops: Animation.Infinite loops: Animation.Infinite
NumberAnimation { from: 0; to: xAnim.animEndPoint; duration: 2000;} NumberAnimation { from: 0; to: xAnim.animEndPoint; duration: 2000;}
@ -161,48 +161,46 @@ QtObject {
} }
} }
property Component sidebar_category: Component { property Component sidebar_category: Component {
ButtonStyle { ButtonStyle {
background: Rectangle { background: Rectangle {
anchors.fill: parent; anchors.fill: parent;
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: Theme.getSize("default_margin").width
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.rightMargin: Theme.getSize("default_margin").width
implicitHeight: UM.Theme.getSize("section").height; implicitHeight: Theme.getSize("section").height;
color: { color: {
if(control.color) { if(control.color) {
return control.color; return control.color;
} else if(!control.enabled) { } else if(!control.enabled) {
return UM.Theme.getColor("setting_category_disabled"); return Theme.getColor("setting_category_disabled");
} else if(control.hovered && control.checkable && control.checked) { } else if(control.hovered && control.checkable && control.checked) {
return UM.Theme.getColor("setting_category_active_hover"); return Theme.getColor("setting_category_active_hover");
} else if(control.pressed || (control.checkable && control.checked)) { } else if(control.pressed || (control.checkable && control.checked)) {
return UM.Theme.getColor("setting_category_active"); return Theme.getColor("setting_category_active");
} else if(control.hovered) { } else if(control.hovered) {
return UM.Theme.getColor("setting_category_hover"); return Theme.getColor("setting_category_hover");
} else { } else {
return UM.Theme.getColor("setting_category"); return Theme.getColor("setting_category");
} }
} }
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
Rectangle { Rectangle {
height: UM.Theme.getSize("default_lining").height height: Theme.getSize("default_lining").height
width: parent.width width: parent.width
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
color: { color: {
if(!control.enabled) { if(!control.enabled) {
return UM.Theme.getColor("setting_category_disabled_border"); return Theme.getColor("setting_category_disabled_border");
} else if(control.hovered && control.checkable && control.checked) { } else if(control.hovered && control.checkable && control.checked) {
return UM.Theme.getColor("setting_category_active_hover_border"); return Theme.getColor("setting_category_active_hover_border");
} else if(control.pressed || (control.checkable && control.checked)) { } else if(control.pressed || (control.checkable && control.checked)) {
return UM.Theme.getColor("setting_category_active_border"); return Theme.getColor("setting_category_active_border");
} else if(control.hovered) { } else if(control.hovered) {
return UM.Theme.getColor("setting_category_hover_border"); return Theme.getColor("setting_category_hover_border");
} else { } else {
return UM.Theme.getColor("setting_category_border"); return Theme.getColor("setting_category_border");
} }
} }
} }
@ -214,15 +212,15 @@ QtObject {
id: icon; id: icon;
anchors.left: parent.left anchors.left: parent.left
height: parent.height height: parent.height
width: UM.Theme.getSize("section_icon_column").width width: Theme.getSize("section_icon_column").width
UM.RecolorImage { UM.RecolorImage {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: Theme.getSize("default_margin").width
color: UM.Theme.getColor("setting_category_text") color: Theme.getColor("setting_category_text")
source: control.iconSource; source: control.iconSource;
width: UM.Theme.getSize("section_icon").width; width: Theme.getSize("section_icon").width;
height: UM.Theme.getSize("section_icon").height; height: Theme.getSize("section_icon").height;
sourceSize.width: width + 15 sourceSize.width: width + 15
sourceSize.height: width + 15 sourceSize.height: width + 15
} }
@ -231,13 +229,13 @@ QtObject {
Label { Label {
anchors { anchors {
left: icon.right; left: icon.right;
leftMargin: UM.Theme.getSize("default_lining").width; leftMargin: Theme.getSize("default_lining").width;
right: parent.right; right: parent.right;
verticalCenter: parent.verticalCenter; verticalCenter: parent.verticalCenter;
} }
text: control.text; text: control.text;
font: UM.Theme.getFont("setting_category"); font: Theme.getFont("setting_category");
color: UM.Theme.getColor("setting_category_text"); color: Theme.getColor("setting_category_text");
fontSizeMode: Text.HorizontalFit; fontSizeMode: Text.HorizontalFit;
minimumPointSize: 8 minimumPointSize: 8
} }
@ -245,13 +243,13 @@ QtObject {
id: category_arrow id: category_arrow
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width * 2 - width / 2 anchors.rightMargin: Theme.getSize("default_margin").width * 2 - width / 2
width: UM.Theme.getSize("standard_arrow").width width: Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height height: Theme.getSize("standard_arrow").height
sourceSize.width: width sourceSize.width: width
sourceSize.height: width sourceSize.height: width
color: UM.Theme.getColor("setting_category_text") color: Theme.getColor("setting_category_text")
source: control.checked ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") source: control.checked ? Theme.getIcon("arrow_bottom") : Theme.getIcon("arrow_left")
} }
} }
} }
@ -265,62 +263,62 @@ QtObject {
transientScrollBars: false transientScrollBars: false
scrollBarBackground: Rectangle { scrollBarBackground: Rectangle {
implicitWidth: UM.Theme.getSize("scrollbar").width implicitWidth: Theme.getSize("scrollbar").width
radius: implicitWidth / 2 radius: implicitWidth / 2
color: UM.Theme.getColor("scrollbar_background"); color: Theme.getColor("scrollbar_background");
} }
handle: Rectangle { handle: Rectangle {
id: scrollViewHandle id: scrollViewHandle
implicitWidth: UM.Theme.getSize("scrollbar").width; implicitWidth: Theme.getSize("scrollbar").width;
radius: implicitWidth / 2 radius: implicitWidth / 2
color: styleData.pressed ? UM.Theme.getColor("scrollbar_handle_down") : styleData.hovered ? UM.Theme.getColor("scrollbar_handle_hover") : UM.Theme.getColor("scrollbar_handle"); color: styleData.pressed ? Theme.getColor("scrollbar_handle_down") : styleData.hovered ? Theme.getColor("scrollbar_handle_hover") : Theme.getColor("scrollbar_handle");
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
} }
} }
} }
property variant setting_item: UM.SettingItemStyle { property variant setting_item: UM.SettingItemStyle {
labelFont: UM.Theme.getFont("default"); labelFont: Theme.getFont("default");
labelColor: UM.Theme.getColor("setting_control_text"); labelColor: Theme.getColor("setting_control_text");
spacing: UM.Theme.getSize("default_lining").height; spacing: Theme.getSize("default_lining").height;
fixedHeight: UM.Theme.getSize("setting").height; fixedHeight: Theme.getSize("setting").height;
controlWidth: UM.Theme.getSize("setting_control").width; controlWidth: Theme.getSize("setting_control").width;
controlRightMargin: UM.Theme.getSize("setting_control_margin").width; controlRightMargin: Theme.getSize("setting_control_margin").width;
controlColor: UM.Theme.getColor("setting_control"); controlColor: Theme.getColor("setting_control");
controlHighlightColor: UM.Theme.getColor("setting_control_highlight"); controlHighlightColor: Theme.getColor("setting_control_highlight");
controlBorderColor: UM.Theme.getColor("setting_control_border"); controlBorderColor: Theme.getColor("setting_control_border");
controlBorderHighlightColor: UM.Theme.getColor("setting_control_border_highlight"); controlBorderHighlightColor: Theme.getColor("setting_control_border_highlight");
controlTextColor: UM.Theme.getColor("setting_control_text"); controlTextColor: Theme.getColor("setting_control_text");
controlBorderWidth: UM.Theme.getSize("default_lining").width; controlBorderWidth: Theme.getSize("default_lining").width;
controlFont: UM.Theme.getFont("default"); controlFont: Theme.getFont("default");
validationErrorColor: UM.Theme.getColor("setting_validation_error"); validationErrorColor: Theme.getColor("setting_validation_error");
validationWarningColor: UM.Theme.getColor("setting_validation_warning"); validationWarningColor: Theme.getColor("setting_validation_warning");
validationOkColor: UM.Theme.getColor("setting_validation_ok"); validationOkColor: Theme.getColor("setting_validation_ok");
unitRightMargin: UM.Theme.getSize("setting_unit_margin").width; unitRightMargin: Theme.getSize("setting_unit_margin").width;
unitColor: UM.Theme.getColor("setting_unit"); unitColor: Theme.getColor("setting_unit");
unitFont: UM.Theme.getFont("default"); unitFont: Theme.getFont("default");
} }
property Component checkbox: Component { property Component checkbox: Component {
CheckBoxStyle { CheckBoxStyle {
background: Item { } background: Item { }
indicator: Rectangle { indicator: Rectangle {
implicitWidth: UM.Theme.getSize("checkbox").width; implicitWidth: Theme.getSize("checkbox").width;
implicitHeight: UM.Theme.getSize("checkbox").height; implicitHeight: Theme.getSize("checkbox").height;
color: (control.hovered || control.hovered_ex) ? UM.Theme.getColor("checkbox_hover") : UM.Theme.getColor("checkbox"); color: (control.hovered || control.hovered_ex) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox");
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
radius: control.exclusiveGroup ? UM.Theme.getSize("checkbox").width / 2 : 0 radius: control.exclusiveGroup ? Theme.getSize("checkbox").width / 2 : 0
border.width: UM.Theme.getSize("default_lining").width; border.width: Theme.getSize("default_lining").width;
border.color: (control.hovered || control.hovered_ex) ? UM.Theme.getColor("checkbox_border_hover") : UM.Theme.getColor("checkbox_border"); border.color: (control.hovered || control.hovered_ex) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border");
UM.RecolorImage { UM.RecolorImage {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -329,16 +327,16 @@ QtObject {
height: parent.height/2.5 height: parent.height/2.5
sourceSize.width: width sourceSize.width: width
sourceSize.height: width sourceSize.height: width
color: UM.Theme.getColor("checkbox_mark") color: Theme.getColor("checkbox_mark")
source: control.exclusiveGroup ? UM.Theme.getIcon("dot") : UM.Theme.getIcon("check") source: control.exclusiveGroup ? Theme.getIcon("dot") : Theme.getIcon("check")
opacity: control.checked opacity: control.checked
Behavior on opacity { NumberAnimation { duration: 100; } } Behavior on opacity { NumberAnimation { duration: 100; } }
} }
} }
label: Label { label: Label {
text: control.text; text: control.text;
color: UM.Theme.getColor("checkbox_text"); color: Theme.getColor("checkbox_text");
font: UM.Theme.getFont("default"); font: Theme.getFont("default");
} }
} }
} }
@ -347,11 +345,11 @@ QtObject {
SliderStyle { SliderStyle {
groove: Rectangle { groove: Rectangle {
implicitWidth: control.width; implicitWidth: control.width;
implicitHeight: UM.Theme.getSize("slider_groove").height; implicitHeight: Theme.getSize("slider_groove").height;
color: UM.Theme.getColor("slider_groove"); color: Theme.getColor("slider_groove");
border.width: UM.Theme.getSize("default_lining").width; border.width: Theme.getSize("default_lining").width;
border.color: UM.Theme.getColor("slider_groove_border"); border.color: Theme.getColor("slider_groove_border");
Rectangle { Rectangle {
anchors { anchors {
@ -359,14 +357,14 @@ QtObject {
top: parent.top; top: parent.top;
bottom: parent.bottom; bottom: parent.bottom;
} }
color: UM.Theme.getColor("slider_groove_fill"); color: Theme.getColor("slider_groove_fill");
width: (control.value / (control.maximumValue - control.minimumValue)) * parent.width; width: (control.value / (control.maximumValue - control.minimumValue)) * parent.width;
} }
} }
handle: Rectangle { handle: Rectangle {
width: UM.Theme.getSize("slider_handle").width; width: Theme.getSize("slider_handle").width;
height: UM.Theme.getSize("slider_handle").height; height: Theme.getSize("slider_handle").height;
color: control.hovered ? UM.Theme.getColor("slider_handle_hover") : UM.Theme.getColor("slider_handle"); color: control.hovered ? Theme.getColor("slider_handle_hover") : Theme.getColor("slider_handle");
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
} }
} }
@ -377,28 +375,28 @@ QtObject {
groove: Rectangle { groove: Rectangle {
id: layerSliderGroove id: layerSliderGroove
implicitWidth: control.width; implicitWidth: control.width;
implicitHeight: UM.Theme.getSize("slider_groove").height; implicitHeight: Theme.getSize("slider_groove").height;
radius: width/2; radius: width/2;
color: UM.Theme.getColor("slider_groove"); color: Theme.getColor("slider_groove");
border.width: UM.Theme.getSize("default_lining").width; border.width: Theme.getSize("default_lining").width;
border.color: UM.Theme.getColor("slider_groove_border"); border.color: Theme.getColor("slider_groove_border");
Rectangle { Rectangle {
anchors { anchors {
left: parent.left; left: parent.left;
top: parent.top; top: parent.top;
bottom: parent.bottom; bottom: parent.bottom;
} }
color: UM.Theme.getColor("slider_groove_fill"); color: Theme.getColor("slider_groove_fill");
width: (control.value / (control.maximumValue - control.minimumValue)) * parent.width; width: (control.value / (control.maximumValue - control.minimumValue)) * parent.width;
radius: width/2 radius: width/2
} }
} }
handle: Rectangle { handle: Rectangle {
id: layerSliderControl id: layerSliderControl
width: UM.Theme.getSize("slider_handle").width; width: Theme.getSize("slider_handle").width;
height: UM.Theme.getSize("slider_handle").height; height: Theme.getSize("slider_handle").height;
color: control.hovered ? UM.Theme.getColor("slider_handle_hover") : UM.Theme.getColor("slider_handle"); color: control.hovered ? Theme.getColor("slider_handle_hover") : Theme.getColor("slider_handle");
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
TextField { TextField {
id: valueLabel id: valueLabel
@ -413,17 +411,17 @@ QtObject {
validator: IntValidator {bottom: 1; top: control.maximumValue + 1;} validator: IntValidator {bottom: 1; top: control.maximumValue + 1;}
visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false
anchors.top: layerSliderControl.bottom anchors.top: layerSliderControl.bottom
anchors.topMargin: width/2 - UM.Theme.getSize("default_margin").width/2 anchors.topMargin: width/2 - Theme.getSize("default_margin").width/2
anchors.horizontalCenter: layerSliderControl.horizontalCenter anchors.horizontalCenter: layerSliderControl.horizontalCenter
rotation: 90 rotation: 90
style: TextFieldStyle{ style: TextFieldStyle{
textColor: UM.Theme.getColor("setting_control_text"); textColor: Theme.getColor("setting_control_text");
font: UM.Theme.getFont("default"); font: Theme.getFont("default");
background: Rectangle { background: Rectangle {
implicitWidth: control.maxValue.length * valueLabel.font.pixelSize + UM.Theme.getSize("default_margin").width implicitWidth: control.maxValue.length * valueLabel.font.pixelSize + Theme.getSize("default_margin").width
implicitHeight: UM.Theme.getSize("slider_handle").height + UM.Theme.getSize("default_margin").width implicitHeight: Theme.getSize("slider_handle").height + Theme.getSize("default_margin").width
border.width: UM.Theme.getSize("default_lining").width; border.width: Theme.getSize("default_lining").width;
border.color: UM.Theme.getColor("slider_groove_border"); border.color: Theme.getColor("slider_groove_border");
} }
} }
} }
@ -433,27 +431,27 @@ QtObject {
property Component text_field: Component { property Component text_field: Component {
TextFieldStyle { TextFieldStyle {
textColor: UM.Theme.getColor("setting_control_text"); textColor: Theme.getColor("setting_control_text");
font: UM.Theme.getFont("default"); font: Theme.getFont("default");
background: Rectangle background: Rectangle
{ {
implicitHeight: control.height; implicitHeight: control.height;
implicitWidth: control.width; implicitWidth: control.width;
border.width: UM.Theme.getSize("default_lining").width; border.width: Theme.getSize("default_lining").width;
border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border"); border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border");
color: UM.Theme.getColor("setting_validation_ok"); color: Theme.getColor("setting_validation_ok");
Label { Label {
anchors.right: parent.right; anchors.right: parent.right;
anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width; anchors.rightMargin: Theme.getSize("setting_unit_margin").width;
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter;
text: control.unit ? control.unit : "" text: control.unit ? control.unit : ""
color: UM.Theme.getColor("setting_unit"); color: Theme.getColor("setting_unit");
font: UM.Theme.getFont("default"); font: Theme.getFont("default");
} }
} }
} }