From 51d3945c0b224029bfc46f6d0462ba279b6fa1f7 Mon Sep 17 00:00:00 2001 From: Kevin Whitaker Date: Thu, 23 Jul 2020 14:48:51 -0400 Subject: [PATCH] User header instead of columnlayout to better add widgets to top of listview. --- src/contents/ui/main.qml | 100 ++++++++++++++++++++------------------- 1 file changed, 51 insertions(+), 49 deletions(-) diff --git a/src/contents/ui/main.qml b/src/contents/ui/main.qml index b043aef..b4624a8 100644 --- a/src/contents/ui/main.qml +++ b/src/contents/ui/main.qml @@ -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 - } - 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 - } + 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: 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); + } + } + ] + } + } } } } -- GitLab