7import QtQuick.Templates as T
8import QtQuick.Controls as Controls
11import org.kde.kirigami as Kirigami
13import "private" as Private
52 property string description:
""
57 property var leading: null
62 property real leadingPadding:
Kirigami.Units.smallSpacing
68 property var trailing: null
73 property real trailingPadding:
Kirigami.Units.smallSpacing
79 property alias descriptionItem: internalDescriptionItem
81 horizontalPadding: Private.FormCardUnits.horizontalPadding
82 verticalPadding: Private.FormCardUnits.verticalPadding
84 implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
85 implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
87 focusPolicy:
Qt.StrongFocus
92 width:
Kirigami.Units.iconSizes.smallMedium
93 height:
Kirigami.Units.iconSizes.smallMedium
96 Layout.fillWidth:
true
98 contentItem: ColumnLayout {
99 spacing: Private.FormCardUnits.verticalSpacing
106 Layout.fillWidth:
true
108 Private.ContentItemLoader {
109 Layout.rightMargin: visible ? root.leadingPadding : 0
110 visible: root.leading
111 implicitHeight: visible ? root.leading.implicitHeight : 0
112 implicitWidth: visible ? root.leading.implicitWidth : 0
113 contentItem: root.leading
118 focusPolicy:
Qt.NoFocus
119 Layout.rightMargin: Private.FormCardUnits.horizontalSpacing
121 enabled: root.enabled
122 checked: root.checked
132 onToggled: root.toggled()
133 onClicked: root.clicked()
134 onPressAndHold: root.pressAndHold()
135 onDoubleClicked: root.doubleClicked()
138 root.checked = checked;
139 checked =
Qt.binding(() => root.checked);
144 visible: root.icon.name.length > 0 || root.icon.source.toString().length > 0
145 source: root.icon.name.length > 0 ? root.icon.name : root.icon.source
146 color: root.icon.color
147 Layout.rightMargin: visible ?
Kirigami.Units.largeSpacing +
Kirigami.Units.smallSpacing : 0
148 implicitWidth: visible ? root.icon.width : 0
149 implicitHeight: visible ? root.icon.height : 0
153 Layout.fillWidth:
true
155 color: root.enabled ?
Kirigami.Theme.textColor :
Kirigami.Theme.disabledTextColor
156 elide:
Text.ElideRight
161 Private.ContentItemLoader {
162 Layout.leftMargin: visible ? root.trailingPadding : 0
163 visible: root.trailing
164 implicitHeight: visible ? root.trailing.implicitHeight : 0
165 implicitWidth: visible ? root.trailing.implicitWidth : 0
166 contentItem: root.trailing
171 id: internalDescriptionItem
173 visible: root.description !==
""
174 Layout.fillWidth:
true
175 text: root.description
176 color:
Kirigami.Theme.disabledTextColor