Changeset View
Changeset View
Standalone View
Standalone View
org.kde.desktop/Switch.qml
Show All 16 Lines | |||||
17 | * the packaging of this file. Please review the following information to | 17 | * the packaging of this file. Please review the following information to | ||
18 | * ensure the GNU General Public License version 2.0 requirements will be | 18 | * ensure the GNU General Public License version 2.0 requirements will be | ||
19 | * met: http://www.gnu.org/licenses/gpl-2.0.html. | 19 | * met: http://www.gnu.org/licenses/gpl-2.0.html. | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | 22 | | |||
23 | import QtQuick 2.6 | 23 | import QtQuick 2.6 | ||
24 | import QtQuick.Templates 2.0 as T | 24 | import QtQuick.Templates 2.0 as T | ||
25 | import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate | 25 | import org.kde.kirigami 2.2 as Kirigami | ||
26 | 26 | | |||
27 | T.CheckBox { | 27 | T.CheckBox { | ||
28 | id: control | 28 | id: control | ||
29 | 29 | | |||
30 | implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding | 30 | implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding | ||
31 | implicitHeight: Math.max(contentItem.implicitHeight, | 31 | implicitHeight: Math.max(contentItem.implicitHeight, | ||
32 | indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding | 32 | indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding | ||
33 | baselineOffset: contentItem.y + contentItem.baselineOffset | 33 | baselineOffset: contentItem.y + contentItem.baselineOffset | ||
34 | 34 | | |||
35 | padding: 1 | 35 | padding: 1 | ||
36 | spacing: Math.round(StylePrivate.TextSingleton.height / 8) | 36 | spacing: Kirigami.Units.smallSpacing | ||
37 | 37 | | |||
38 | hoverEnabled: true | 38 | hoverEnabled: true | ||
39 | 39 | | |||
40 | indicator: SwitchIndicator { | 40 | indicator: SwitchIndicator { | ||
41 | LayoutMirroring.enabled: control.mirrored | 41 | LayoutMirroring.enabled: control.mirrored | ||
42 | LayoutMirroring.childrenInherit: true | 42 | LayoutMirroring.childrenInherit: true | ||
43 | height: 22 | 43 | height: 22 | ||
44 | anchors { | 44 | anchors { | ||
45 | left: parent.left | 45 | left: parent.left | ||
46 | verticalCenter: parent.verticalCenter | 46 | verticalCenter: parent.verticalCenter | ||
47 | } | 47 | } | ||
48 | control: control | 48 | control: control | ||
49 | } | 49 | } | ||
50 | 50 | | |||
51 | contentItem: Label { | 51 | contentItem: Label { | ||
52 | leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 | 52 | leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 | ||
53 | rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 | 53 | rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 | ||
54 | opacity: control.enabled ? 1 : 0.6 | 54 | opacity: control.enabled ? 1 : 0.6 | ||
55 | text: control.text | 55 | text: control.text | ||
56 | font: control.font | 56 | font: control.font | ||
57 | color: StylePrivate.SystemPaletteSingleton.text(control.enabled) | 57 | color: Kirigami.Theme.textColor | ||
58 | elide: Text.ElideRight | 58 | elide: Text.ElideRight | ||
59 | visible: control.text | 59 | visible: control.text | ||
60 | horizontalAlignment: Text.AlignLeft | 60 | horizontalAlignment: Text.AlignLeft | ||
61 | verticalAlignment: Text.AlignVCenter | 61 | verticalAlignment: Text.AlignVCenter | ||
62 | } | 62 | } | ||
63 | } | 63 | } |