Changeset View
Changeset View
Standalone View
Standalone View
org.kde.desktop/RadioButton.qml
Show All 17 Lines | |||||
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 QtQuick.Controls 2.0 | 25 | import QtQuick.Controls 2.0 | ||
26 | import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate | 26 | import org.kde.kirigami 2.2 as Kirigami | ||
27 | 27 | | |||
28 | T.CheckBox { | 28 | T.CheckBox { | ||
29 | id: control | 29 | id: control | ||
30 | 30 | | |||
31 | implicitWidth: Math.max(background ? background.implicitWidth : 0, | 31 | implicitWidth: Math.max(background ? background.implicitWidth : 0, | ||
32 | contentItem.implicitWidth + leftPadding + rightPadding) | 32 | contentItem.implicitWidth + leftPadding + rightPadding) | ||
33 | implicitHeight: Math.max(background ? background.implicitHeight : 0, | 33 | implicitHeight: Math.max(background ? background.implicitHeight : 0, | ||
34 | Math.max(contentItem.implicitHeight, | 34 | Math.max(contentItem.implicitHeight, | ||
35 | indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) | 35 | indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) | ||
36 | baselineOffset: contentItem.y + contentItem.baselineOffset | 36 | baselineOffset: contentItem.y + contentItem.baselineOffset | ||
37 | 37 | | |||
38 | padding: 1 | 38 | padding: 1 | ||
39 | spacing: Math.round(StylePrivate.TextSingleton.height / 8) | 39 | spacing: Kirigami.Units.smallSpacing | ||
40 | 40 | | |||
41 | hoverEnabled: true | 41 | hoverEnabled: true | ||
42 | 42 | | |||
43 | indicator: RadioIndicator { | 43 | indicator: RadioIndicator { | ||
44 | LayoutMirroring.enabled: control.mirrored | 44 | LayoutMirroring.enabled: control.mirrored | ||
45 | LayoutMirroring.childrenInherit: true | 45 | LayoutMirroring.childrenInherit: true | ||
46 | anchors { | 46 | anchors { | ||
47 | left: parent.left | 47 | left: parent.left | ||
48 | verticalCenter: parent.verticalCenter | 48 | verticalCenter: parent.verticalCenter | ||
49 | } | 49 | } | ||
50 | control: control | 50 | control: control | ||
51 | } | 51 | } | ||
52 | 52 | | |||
53 | contentItem: Label { | 53 | contentItem: Label { | ||
54 | leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 | 54 | leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 | ||
55 | rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 | 55 | rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 | ||
56 | opacity: control.enabled ? 1 : 0.6 | 56 | opacity: control.enabled ? 1 : 0.6 | ||
57 | text: control.text | 57 | text: control.text | ||
58 | font: control.font | 58 | font: control.font | ||
59 | color: StylePrivate.SystemPaletteSingleton.text(control.enabled) | 59 | color: Kirigami.Theme.textColor | ||
60 | elide: Text.ElideRight | 60 | elide: Text.ElideRight | ||
61 | visible: control.text | 61 | visible: control.text | ||
62 | horizontalAlignment: Text.AlignLeft | 62 | horizontalAlignment: Text.AlignLeft | ||
63 | verticalAlignment: Text.AlignVCenter | 63 | verticalAlignment: Text.AlignVCenter | ||
64 | } | 64 | } | ||
65 | } | 65 | } |