Set up visuals

This commit is contained in:
Toast 2025-03-26 17:57:52 +01:00
parent e7357da3f3
commit 1571232a79

View file

@ -15,15 +15,79 @@ Kirigami.ApplicationWindow {
// Window title // Window title
// i18nc() makes a string translatable // i18nc() makes a string translatable
// and provides additional context for the translators // and provides additional context for the translators
title: i18nc("@title:window", "Hello World") title: i18nc("@title:window", "Day countdown")
// Set the first page that will be loaded when the app opens // Set the first page that will be loaded when the app opens
// This can also be set to an id of a Kirigami.Page // This can also be set to an id of a Kirigami.Page
pageStack.initialPage: Kirigami.Page { pageStack.initialPage: Kirigami.ScrollablePage {
Controls.Label { title: i18nc("@title", "Countdown")
// Center label horizontally and vertically within parent object Kirigami.CardsListView {
anchors.centerIn: parent id: cardsView
text: i18n("Hello from kirigami!") model: countdownModel
delegate: countdownDelegate
}
}
ListModel {
id: countdownModel
ListElement {
name: "Japan trip!"
description: ":D"
date: 131
}
ListElement {
name: "My birthday!"
description: "Pls give money"
date: 61
}
}
Component {
id: countdownDelegate
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.fillWidth: true
level: 1
text: date
}
ColumnLayout {
Kirigami.Heading {
Layout.fillWidth: true
text: name
}
Kirigami.Separator {
Layout.fillWidth: true
visible: description.length > 0
}
Controls.Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: description
visible: description.length > 0
}
}
Controls.Button {
Layout.alignment: Qt.AlignRight
Layout.columnSpan: 2
text: i18n("Edit")
}
}
}
} }
} }
} }