8import QtQuick.Controls as QQC2
9import QtQuick.Templates as T
12import org.kde.kirigami as Kirigami
14import "private" as Private
55 property real maximumWidth:
Kirigami.Units.gridUnit * 30
62 property real padding: 0
63 property real verticalPadding: padding
64 property real horizontalPadding: padding
65 property real topPadding: verticalPadding
66 property real bottomPadding: verticalPadding
67 property real leftPadding: horizontalPadding
68 property real rightPadding: horizontalPadding
73 readonly
property bool cardWidthRestricted: root.width > root.maximumWidth
102 property list<QtObject> infoCards
104 component InfoCard: QtObject {
105 property bool visible:
true
106 property string title
107 property string subtitle
108 property string buttonIcon
109 property string tooltipText
110 property int subtitleTextFormat: Text.AutoText
117 implicitHeight: topPadding + bottomPadding + grid.implicitHeight
122 bottom: parent.bottom
126 leftMargin: root.cardWidthRestricted ? Math.round((root.width - root.maximumWidth) / 2) : 0
127 rightMargin: root.cardWidthRestricted ? Math.round((root.width - root.maximumWidth) / 2) : 0
133 readonly
property int cellWidth:
Kirigami.Units.gridUnit * 10
134 readonly
property int visibleChildrenCount: visibleChildren.length - 1
138 leftMargin: root.leftPadding
139 rightMargin: root.rightPadding
140 topMargin: root.topPadding
141 bottomMargin: root.bottomPadding
144 columns: root.cardWidthRestricted && grid.visibleChildrenCount % 3 === 0 ? 3 : 2
145 columnSpacing:
Kirigami.Units.smallSpacing
146 rowSpacing:
Kirigami.Units.smallSpacing
151 model: root.infoCards
153 QQC2.AbstractButton {
156 required
property int index
157 required
property QtObject modelData
159 readonly
property string title: modelData.title
160 readonly
property string subtitle: modelData.subtitle
161 readonly
property string buttonIcon: modelData.buttonIcon
162 readonly
property string tooltipText: modelData.tooltipText
163 readonly
property int subtitleTextFormat: modelData.subtitleTextFormat
165 visible: modelData.visible
167 action: modelData.action
169 leftPadding:
Kirigami.Units.largeSpacing
170 rightPadding:
Kirigami.Units.largeSpacing
171 topPadding:
Kirigami.Units.largeSpacing
172 bottomPadding:
Kirigami.Units.largeSpacing
174 leftInset: root.cardWidthRestricted ? 0 : -infoCardDelegate.background.border.width
175 rightInset: root.cardWidthRestricted ? 0 : -infoCardDelegate.background.border.width
179 Accessible.name: title +
" " + subtitle
180 Accessible.role: action ? Accessible.Button : Accessible.Note
182 Layout.preferredWidth: grid.cellWidth
183 Layout.columnSpan: grid.visibleChildrenCount % grid.columns !== 0 && index === grid.visibleChildrenCount - 1 ? 2 : 1
184 Layout.fillWidth:
true
185 Layout.fillHeight:
true
187 QQC2.ToolTip.text: tooltipText
188 QQC2.ToolTip.visible: tooltipText && hovered
189 QQC2.ToolTip.delay:
Kirigami.Units.toolTipDelay
191 background: Rectangle {
192 radius: root.cardWidthRestricted ?
Kirigami.Units.cornerRadius : 0
193 color:
Kirigami.Theme.backgroundColor
202 radius: root.cardWidthRestricted ?
Kirigami.Units.cornerRadius : 0
207 if (!infoCardDelegate.enabled || !infoCardDelegate.action) {
209 }
else if (infoCardDelegate.pressed) {
211 }
else if (infoCardDelegate.visualFocus) {
213 }
else if (!
Kirigami.Settings.tabletMode && infoCardDelegate.hovered) {
221 ColorAnimation { duration:
Kirigami.Units.shortDuration }
226 contentItem: RowLayout {
230 source: infoCardDelegate.buttonIcon
232 Layout.alignment:
Qt.AlignTop
240 Layout.fillWidth:
true
242 text: infoCardDelegate.title
243 verticalAlignment:
Text.AlignVCenter
244 horizontalAlignment: icon.visible ?
Text.AlignLeft :
Text.AlignHCenter
246 elide:
Text.ElideRight
252 Layout.fillWidth:
true
253 Layout.fillHeight:
true
254 visible: infoCardDelegate.subtitle
255 text: infoCardDelegate.subtitle
256 horizontalAlignment: icon.visible ?
Text.AlignLeft :
Text.AlignHCenter
257 elide:
Text.ElideRight
259 textFormat: infoCardDelegate.subtitleTextFormat
261 verticalAlignment:
Text.AlignTop
262 onLinkActivated: (
link) => modelData.linkActivated(link)
KIOCORE_EXPORT CopyJob * link(const QList< QUrl > &src, const QUrl &destDir, JobFlags flags=DefaultFlags)
QStringView level(QStringView ifopt)