7import QtQuick.Templates as T
8import QtQuick.Controls as Controls
11import org.kde.kirigami as Kirigami
13import "private" as Private
49 property string description:
""
55 property var leading: null
60 property real leadingPadding:
Kirigami.Units.smallSpacing
66 property var trailing: null
71 property real trailingPadding:
Kirigami.Units.smallSpacing
73 horizontalPadding: Private.FormCardUnits.horizontalPadding
74 verticalPadding: Private.FormCardUnits.verticalPadding
76 implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
77 implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
79 focusPolicy:
Qt.StrongFocus
84 width:
Kirigami.Units.iconSizes.smallMedium
85 height:
Kirigami.Units.iconSizes.smallMedium
88 Layout.fillWidth:
true
90 Accessible.description: root.description
91 Accessible.role: Accessible.CheckBox
92 Accessible.onPressAction: switchItem.toggle()
93 Accessible.onToggleAction: switchItem.toggle()
95 contentItem: RowLayout {
98 Private.ContentItemLoader {
99 Layout.rightMargin: visible ? root.leadingPadding : 0
100 visible: root.leading
101 implicitHeight: visible ? root.leading.implicitHeight : 0
102 implicitWidth: visible ? root.leading.implicitWidth : 0
103 contentItem: root.leading
107 visible: root.icon.name.length > 0 || root.icon.source.toString().length > 0
108 source: root.icon.name.length > 0 ? root.icon.name : root.icon.source
109 color: root.icon.color
110 Layout.rightMargin: visible ? Private.FormCardUnits.horizontalSpacing : 0
111 implicitWidth: visible ? root.icon.width : 0
112 implicitHeight: visible ? root.icon.height : 0
116 Layout.fillWidth:
true
117 spacing: Private.FormCardUnits.verticalSpacing
120 Layout.fillWidth:
true
122 elide:
Text.ElideRight
125 color: root.enabled ?
Kirigami.Theme.textColor :
Kirigami.Theme.disabledTextColor
126 Accessible.ignored:
true
130 visible: root.description !==
""
131 Layout.fillWidth:
true
132 text: root.description
134 color:
Kirigami.Theme.disabledTextColor
135 Accessible.ignored:
true
141 focusPolicy:
Qt.NoFocus
142 Layout.leftMargin: Private.FormCardUnits.horizontalSpacing
144 enabled: root.enabled
145 checked: root.checked
155 onToggled: root.toggled()
156 onClicked: root.clicked()
157 onPressAndHold: root.pressAndHold()
158 onDoubleClicked: root.doubleClicked()
161 root.checked = checked;
162 checked =
Qt.binding(() => root.checked);
165 Accessible.ignored:
true
168 Private.ContentItemLoader {
169 Layout.leftMargin: visible ? root.trailingPadding : 0
170 visible: root.trailing
171 implicitHeight: visible ? root.trailing.implicitHeight : 0
172 implicitWidth: visible ? root.trailing.implicitWidth : 0
173 contentItem: root.trailing