aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/Switch.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-03-02 18:42:28 +0100
committerJari-Pekka Nurmi <jpnurmi@theqtcompany.com>2015-03-03 02:02:13 +0200
commitaceaa093f90fd006e5b2d9523b8ed6cab7b8577d (patch)
tree40176808133244acfcf09e861ee6c7e997ca8ab0 /src/imports/controls/Switch.qml
parentf965016e5d001e7a844893a46902fb5b0ef84262 (diff)
Update src/imports to use top/left/right/bottomPadding
Change-Id: I9c72db2d8f44429a7c87baaad663b88c7e1f1bb9 Reviewed-by: Jari-Pekka Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/imports/controls/Switch.qml')
-rw-r--r--src/imports/controls/Switch.qml19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/imports/controls/Switch.qml b/src/imports/controls/Switch.qml
index 51768cc6..4ce9801d 100644
--- a/src/imports/controls/Switch.qml
+++ b/src/imports/controls/Switch.qml
@@ -43,10 +43,10 @@ AbstractSwitch {
implicitWidth: Math.max(background ? background.implicitWidth : 0,
(label ? label.implicitWidth : 0) +
(indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? style.spacing : 0) + padding.left + padding.right)
+ (label && indicator ? style.spacing : 0) + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
Math.max(label ? label.implicitHeight : 0,
- indicator ? indicator.implicitHeight : 0) + padding.top + padding.bottom)
+ indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
Accessible.name: text
Accessible.checkable: true
@@ -54,14 +54,17 @@ AbstractSwitch {
Accessible.pressed: pressed
Accessible.role: Accessible.Button // TODO: Switch?
- padding { top: style.padding; left: style.padding; right: style.padding; bottom: style.padding }
+ topPadding: style.padding
+ leftPadding: style.padding
+ rightPadding: style.padding
+ bottomPadding: style.padding
indicator: Rectangle {
readonly property bool mirror: control.effectiveLayoutDirection == Qt.RightToLeft
implicitWidth: 36
implicitHeight: 20
- x: text ? (mirror ? parent.width - width - padding.right : padding.left) : (parent.width - width) / 2
+ x: text ? (mirror ? parent.width - width - control.rightPadding : control.leftPadding) : (parent.width - width) / 2
y: (parent.height - height) / 2
radius: 10
@@ -95,10 +98,10 @@ AbstractSwitch {
label: Text {
readonly property bool mirror: control.effectiveLayoutDirection == Qt.RightToLeft
- x: mirror ? padding.left : (indicator.x + indicator.width + control.style.spacing)
- y: padding.top
- width: parent.width - indicator.width - control.style.spacing - padding.left - padding.right
- height: parent.height - padding.top - padding.bottom
+ x: mirror ? control.leftPadding : (indicator.x + indicator.width + control.style.spacing)
+ y: control.topPadding
+ width: parent.width - indicator.width - control.style.spacing - control.leftPadding - control.rightPadding
+ height: parent.height - control.topPadding - control.bottomPadding
text: control.text
color: control.style.textColor