User header instead of columnlayout to better add widgets to top of listview.

This commit is contained in:
2020-07-23 14:48:51 -04:00
parent edb48c6802
commit 51d3945c0b

View File

@@ -272,62 +272,64 @@ Kirigami.ApplicationWindow {
router.pushRoute({"route": "addrecord", "data": serviceId});
}
}
/*Layouts.ColumnLayout {
anchors.fill: parent
Kirigami.InlineMessage {
ListView {
id: serviceView
Layouts.Layout.fillHeight: true
Layouts.Layout.fillWidth: true
Layouts.Layout.leftMargin: 10
Layouts.Layout.rightMargin: 10
z: 9997
type: Kirigami.MessageType.Information
id: oilMessage
showCloseButton: false
Component.onCompleted: {
//TODO: check if oil change is needed.
model: recordModel
headerPositioning: ListView.OverlayHeader
header: Kirigami.ListSectionHeader {
z: 9997
contentItem: Layouts.ColumnLayout {
Kirigami.InlineMessage {
Layouts.Layout.fillWidth: true
type: Kirigami.MessageType.Information
id: oilMessage
showCloseButton: false
Component.onCompleted: {
//TODO: check if oil change is needed.
}
}
}
}
}*/
ListView {
id: serviceView
model: recordModel
delegate: Kirigami.SwipeListItem {
contentItem: Layouts.ColumnLayout {
Kirigami.Heading {
text: serviceprovider
level: 2
}
Kirigami.Heading {
text: servicetypename
level: 2
delegate: Kirigami.SwipeListItem {
contentItem: Layouts.ColumnLayout {
Kirigami.Heading {
text: serviceprovider
level: 2
}
Kirigami.Heading {
text: servicetypename
level: 2
}
Controls.Label {
text: new Date(servicedate).toLocaleDateString(Qt.locale())
}
Row {
Image {
source: "qrc:/speed.svg"
sourceSize.width: 16
sourceSize.height: 16
}
Controls.Label {
text: new Date(servicedate).toLocaleDateString(Qt.locale())
}
Row {
Image {
source: "qrc:/speed.svg"
sourceSize.width: 16
sourceSize.height: 16
}
Controls.Label {
text: miles
}
}
Controls.Label {
text: notes
text: miles
}
}
actions: [
Kirigami.Action {
text: qsTr("Remove")
iconName: "edit-delete"
onTriggered: {
recordModel.removeRecord(index);
}
}
]
Controls.Label {
text: notes
}
}
}
//}
actions: [
Kirigami.Action {
text: qsTr("Remove")
iconName: "edit-delete"
onTriggered: {
recordModel.removeRecord(index);
}
}
]
}
}
}
}
}