From 5943a32a4b78ddc9594d5a15b73f9d2bea62bb9e Mon Sep 17 00:00:00 2001 From: Black Hat Date: Sun, 5 Aug 2018 14:08:04 +0800 Subject: [PATCH] Move section delegate to header. Switch from builtin section delegate to custom section delegate. Fixes #4. --- qml/form/RoomForm.qml | 44 +++++++++++++++++++++++++-------------- qml/form/RoomListForm.qml | 1 + 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/qml/form/RoomForm.qml b/qml/form/RoomForm.qml index 3c672fc..6e041fb 100644 --- a/qml/form/RoomForm.qml +++ b/qml/form/RoomForm.qml @@ -101,26 +101,38 @@ Item { room: currentRoom } - delegate: MessageDelegate {} + delegate: Column { + width: parent.width + spacing: 8 - section.property: "section" - section.criteria: ViewSection.FullString - section.delegate: RowLayout { - width: parent.width * 0.6 - anchors.right: parent.right + RowLayout { + readonly property bool sectionVisible: section !== aboveSection - Rectangle { - Layout.fillWidth: true - height:2 - color: Material.accent + width: parent.width * 0.8 + visible: sectionVisible + anchors.horizontalCenter: parent.horizontalCenter + spacing: 8 + + Rectangle { + Layout.fillWidth: true + height:2 + color: Material.accent + } + + Label { + text: section + color: Material.accent + verticalAlignment: Text.AlignVCenter + } + + Rectangle { + Layout.fillWidth: true + height:2 + color: Material.accent + } } - Label { - padding: 4 - text: section - color: Material.accent - verticalAlignment: Text.AlignVCenter - } + MessageDelegate {} } ScrollBar.vertical: messageListViewScrollBar diff --git a/qml/form/RoomListForm.qml b/qml/form/RoomListForm.qml index 7426b14..7f89764 100644 --- a/qml/form/RoomListForm.qml +++ b/qml/form/RoomListForm.qml @@ -31,6 +31,7 @@ Item { id: searchField width: parent.width height: 36 + color: "black" leftPadding: mini ? 4 : 16 topPadding: 0 bottomPadding: 0