Set up visuals
This commit is contained in:
parent
e7357da3f3
commit
1571232a79
1 changed files with 70 additions and 6 deletions
74
src/Main.qml
74
src/Main.qml
|
|
@ -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 {
|
||||||
|
title: i18nc("@title", "Countdown")
|
||||||
|
Kirigami.CardsListView {
|
||||||
|
id: cardsView
|
||||||
|
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 {
|
Controls.Label {
|
||||||
// Center label horizontally and vertically within parent object
|
Layout.fillWidth: true
|
||||||
anchors.centerIn: parent
|
wrapMode: Text.WordWrap
|
||||||
text: i18n("Hello from kirigami!")
|
text: description
|
||||||
|
visible: description.length > 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Controls.Button {
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
text: i18n("Edit")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue