add more to the HelloWorld Kirigami app

this time, theres cards!
This commit is contained in:
Fries 2023-06-26 21:40:26 -07:00
parent c9b7d9bd1b
commit ce52d1970c

View file

@ -5,12 +5,74 @@ import org.kde.kirigami 2.20 as Kirigami
Kirigami.ApplicationWindow {
id: root
title: i18nc("@title:window", "HelloWorld")
pageStack.initialPage: Kirigami.Page {
ListModel {
id: kountdownModel
ListElement {
name: "Meow"
description: "Meowy!"
date: 420
}
}
Component {
id: kountdownDelegate
Kirigami.AbstractCard {
contentItem: Item {
implicitWidth: delegateLayout.implicitWidth
implicitHeight: delegateLayout.implicitHeight
GridLayout {
id: delegateLayout
anchors {
left: parent.left
top: parent.top
right: parent.right
}
rowSpacing: Kirigami.Units.largeSpacing
columnSpacing: Kirigami.Units.largeSpacing
columns: root.wideScreen ? 4 : 2
Kirigami.Heading {
Layout.fillHeight: true
level: 1
text: (date < 100000) ? date : i18n("%1 days", Math.round((date-Date.now()/86400000)))
}
ColumnLayout {
Kirigami.Heading {
Layout.fillWidth: true
level: 2
text: name
}
Kirigami.Separator {
Layout.fillWidth: true
visible: description.length > 0
}
Controls.Label {
anchors.centerIn: parent
text: i18n("Meow!")
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: description
visible: description.length > 0
}
}
Controls.Button {
Layout.alignment: Qt.AlignRight
Layout.columnSpan: 2
text: i18n("Edit")
}
}
}
}
}
pageStack.initialPage: Kirigami.ScrollablePage {
title: i18nc("@title", "Kountdown")
Kirigami.CardsListView {
id: cardsView
model: kountdownModel
delegate: kountdownDelegate
}
}
}