diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-02-05 15:37:46 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-02-06 13:16:20 +0000 |
commit | bbed8f6a8554b3edf6198671ee4e36995ba0726b (patch) | |
tree | 8c07d92d3119d0f48cfff99a6fb1a11c50d7b392 /src/imports/controls/universal/Switch.qml | |
parent | 0cb85683406737dfb715218124c7b2d1936f855b (diff) |
Switch: migrate from label to contentItem
Change-Id: Ic287fc207b689d5f4a252a527b536272ad94c057
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/imports/controls/universal/Switch.qml')
-rw-r--r-- | src/imports/controls/universal/Switch.qml | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/imports/controls/universal/Switch.qml b/src/imports/controls/universal/Switch.qml index ca33e121..f37c1054 100644 --- a/src/imports/controls/universal/Switch.qml +++ b/src/imports/controls/universal/Switch.qml @@ -42,13 +42,11 @@ T.Switch { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - (label ? label.implicitWidth : 0) + - (indicator ? indicator.implicitWidth : 0) + - (label && indicator ? spacing : 0) + leftPadding + rightPadding) + contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - Math.max(label ? label.implicitHeight : 0, + Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) - baselineOffset: label ? label.y + label.baselineOffset : 0 + baselineOffset: contentItem.y + contentItem.baselineOffset padding: 5 spacing: 8 @@ -90,12 +88,10 @@ T.Switch { } //! [indicator] - //! [label] - label: Text { - x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.spacing) - y: control.topPadding - width: control.availableWidth - indicator.width - control.spacing - height: control.availableHeight + //! [contentItem] + contentItem: Text { + leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 + rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 text: control.text font: control.font @@ -107,5 +103,5 @@ T.Switch { color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor } - //! [label] + //! [contentItem] } |