Put sizes and numbers for toggle button into theme

CURA-3574
This commit is contained in:
Lipu Fei 2017-04-19 08:56:08 +02:00
parent 6bf0965632
commit 61c4631270
3 changed files with 14 additions and 9 deletions

View File

@ -423,7 +423,7 @@ Rectangle
{ {
id: toggleLeftText id: toggleLeftText
anchors.right: modeToggleSwitch.left anchors.right: modeToggleSwitch.left
anchors.rightMargin: 10 anchors.rightMargin: UM.Theme.getSize("toggle_button_text_anchoring_margin").width
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: "" text: ""
color: UM.Theme.getColor("toggle_active_text") color: UM.Theme.getColor("toggle_active_text")
@ -435,7 +435,7 @@ Rectangle
id: modeToggleSwitch id: modeToggleSwitch
checked: false checked: false
anchors.right: toggleRightText.left anchors.right: toggleRightText.left
anchors.rightMargin: 10 anchors.rightMargin: UM.Theme.getSize("toggle_button_text_anchoring_margin").width
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
onClicked: onClicked:

View File

@ -11,9 +11,9 @@ QtObject {
property Component toggle_button: Component { property Component toggle_button: Component {
SwitchStyle { SwitchStyle {
groove: Rectangle { groove: Rectangle {
implicitWidth: 30 implicitWidth: UM.Theme.getSize("toggle_button_background_implicit_size").width
implicitHeight: 15 implicitHeight: UM.Theme.getSize("toggle_button_background_implicit_size").height
radius: 9 radius: UM.Theme.getSize("toggle_button_radius").width
border.color: { border.color: {
if (control.pressed || (control.checkable && control.checked)) { if (control.pressed || (control.checkable && control.checked)) {
return UM.Theme.getColor("sidebar_header_active"); return UM.Theme.getColor("sidebar_header_active");
@ -28,9 +28,9 @@ QtObject {
} }
handle: Rectangle { handle: Rectangle {
implicitHeight: 15 implicitWidth: UM.Theme.getSize("toggle_button_knob_implicit_size").width
implicitWidth: 15 implicitHeight: UM.Theme.getSize("toggle_button_knob_implicit_size").height
radius: 9 radius: UM.Theme.getSize("toggle_button_radius").width
color: { color: {
if (control.pressed || (control.checkable && control.checked)) { if (control.pressed || (control.checkable && control.checked)) {

View File

@ -319,6 +319,11 @@
"infill_button_margin": [0.5, 0.5], "infill_button_margin": [0.5, 0.5],
"jobspecs_line": [2.0, 2.0] "jobspecs_line": [2.0, 2.0],
"toggle_button_text_anchoring_margin": [1.0, 1.0],
"toggle_button_radius": [1.0, 1.0],
"toggle_button_background_implicit_size": [2.0, 1.0],
"toggle_button_knob_implicit_size": [1.0, 1.0]
} }
} }