aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/ToggleButton.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-03-06 11:52:10 +0100
committerJari-Pekka Nurmi <jpnurmi@theqtcompany.com>2015-03-11 01:06:44 +0200
commita3921bcf01275425350c9c153fe92086a34d1403 (patch)
tree1c5c4dd36e9d19a36281bde723c7bf989bc70298 /src/imports/controls/ToggleButton.qml
parente9398b7465c7df38876d0c6528ea5c42bbd8bf6a (diff)
Implement Style as an attached property
Change-Id: I006ee566647e31d1a14919d164d7dd68539aae10 Reviewed-by: Jari-Pekka Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/imports/controls/ToggleButton.qml')
-rw-r--r--src/imports/controls/ToggleButton.qml28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/imports/controls/ToggleButton.qml b/src/imports/controls/ToggleButton.qml
index 61fd69dd..7ab30bd3 100644
--- a/src/imports/controls/ToggleButton.qml
+++ b/src/imports/controls/ToggleButton.qml
@@ -43,7 +43,7 @@ AbstractToggleButton {
implicitWidth: Math.max(background ? background.implicitWidth : 0,
(label ? label.implicitWidth : 0) +
(indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? style.spacing : 0) + leftPadding + rightPadding)
+ (label && indicator ? Style.spacing : 0) + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
Math.max(label ? label.implicitHeight : 0,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
@@ -54,7 +54,7 @@ AbstractToggleButton {
Accessible.pressed: pressed
Accessible.role: Accessible.Button
- padding: style.padding
+ padding: Style.padding
indicator: Rectangle {
readonly property bool mirror: control.effectiveLayoutDirection == Qt.RightToLeft
@@ -64,21 +64,21 @@ AbstractToggleButton {
x: text ? (mirror ? parent.width - width - control.rightPadding : control.leftPadding) : (parent.width - width) / 2
y: (parent.height - height) / 2
- radius: style.roundness
+ radius: control.Style.roundness
border.width: control.activeFocus ? 2 : 1
- border.color: control.activeFocus ? style.focusColor : style.frameColor
- opacity: enabled ? 1.0 : style.disabledOpacity
- color: style.backgroundColor
+ border.color: control.activeFocus ? control.Style.focusColor : control.Style.frameColor
+ opacity: enabled ? 1.0 : control.Style.disabledOpacity
+ color: control.Style.backgroundColor
Rectangle {
width: 12
height: 12
- color: Qt.tint(Qt.tint(control.checked ? style.accentColor : style.baseColor,
- control.checked && control.activeFocus ? style.focusColor : "transparent"),
- control.pressed ? style.pressColor : "transparent")
+ color: Qt.tint(Qt.tint(control.checked ? control.Style.accentColor : control.Style.baseColor,
+ control.checked && control.activeFocus ? control.Style.focusColor : "transparent"),
+ control.pressed ? control.Style.pressColor : "transparent")
border.width: control.checked || control.pressed ? 0 : 1
- border.color: style.frameColor
+ border.color: control.Style.frameColor
x: Math.max(4, Math.min(parent.width - width - 4,
control.visualPosition * parent.width - (width / 2)))
@@ -94,16 +94,16 @@ AbstractToggleButton {
label: Text {
readonly property bool mirror: control.effectiveLayoutDirection == Qt.RightToLeft
- x: mirror ? control.leftPadding : (indicator.x + indicator.width + control.style.spacing)
+ 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
+ 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
+ color: control.Style.textColor
elide: Text.ElideRight
visible: control.text
- opacity: enabled ? 1.0 : control.style.disabledOpacity
+ opacity: enabled ? 1.0 : control.Style.disabledOpacity
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}