Skip to content

Commit

Permalink
Put sizes and numbers for toggle button into theme
Browse files Browse the repository at this point in the history
CURA-3574
  • Loading branch information
LipuFei committed Apr 19, 2017
1 parent 6bf0965 commit 61c4631
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions resources/qml/Sidebar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ Rectangle
{
id: toggleLeftText
anchors.right: modeToggleSwitch.left
anchors.rightMargin: 10
anchors.rightMargin: UM.Theme.getSize("toggle_button_text_anchoring_margin").width
anchors.verticalCenter: parent.verticalCenter
text: ""
color: UM.Theme.getColor("toggle_active_text")
Expand All @@ -435,7 +435,7 @@ Rectangle
id: modeToggleSwitch
checked: false
anchors.right: toggleRightText.left
anchors.rightMargin: 10
anchors.rightMargin: UM.Theme.getSize("toggle_button_text_anchoring_margin").width
anchors.verticalCenter: parent.verticalCenter

onClicked:
Expand Down
12 changes: 6 additions & 6 deletions resources/themes/cura/styles.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ QtObject {
property Component toggle_button: Component {
SwitchStyle {
groove: Rectangle {
implicitWidth: 30
implicitHeight: 15
radius: 9
implicitWidth: UM.Theme.getSize("toggle_button_background_implicit_size").width
implicitHeight: UM.Theme.getSize("toggle_button_background_implicit_size").height
radius: UM.Theme.getSize("toggle_button_radius").width
border.color: {
if (control.pressed || (control.checkable && control.checked)) {
return UM.Theme.getColor("sidebar_header_active");
Expand All @@ -28,9 +28,9 @@ QtObject {
}

handle: Rectangle {
implicitHeight: 15
implicitWidth: 15
radius: 9
implicitWidth: UM.Theme.getSize("toggle_button_knob_implicit_size").width
implicitHeight: UM.Theme.getSize("toggle_button_knob_implicit_size").height
radius: UM.Theme.getSize("toggle_button_radius").width

color: {
if (control.pressed || (control.checkable && control.checked)) {
Expand Down
7 changes: 6 additions & 1 deletion resources/themes/cura/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@

"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]
}
}

0 comments on commit 61c4631

Please sign in to comment.