From 0405a8ba3984f5502959c8add0554da5dbf33a41 Mon Sep 17 00:00:00 2001 From: Jeena Date: Wed, 21 Jan 2015 20:08:16 +0100 Subject: [PATCH] some list stuff --- PostListItem.qml | 34 ++++++++++++++++++++++++++-------- main.qml | 18 +++++++++++------- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/PostListItem.qml b/PostListItem.qml index 89691ea..d781d4a 100644 --- a/PostListItem.qml +++ b/PostListItem.qml @@ -2,30 +2,48 @@ import QtQuick 2.0 Item { property ListView listView - height: column.height + + height: column.height + 10 + width: listView.parent.width Rectangle { - color: "white" - anchors.margins: 10 anchors.fill: parent + anchors.leftMargin: 10 + anchors.rightMargin: 10 + anchors.topMargin: 5 + anchors.bottomMargin: 5 + color: "transparent" + Column { id: column - Text { - text: "[" + date.toLocaleString(null, "hh:mm:ss") + "] " + feedTitle - font.pointSize: 9 - color: "gray" - wrapMode: Text.Wrap + + Row { + spacing: 10 + Text { + text: feedTitle + font.pointSize: 9 + color: "gray" + wrapMode: Text.Wrap + } + Text { + text: date.toLocaleString(null) + font.pointSize: 9 + color: "gray" + wrapMode: Text.Wrap + } } Text { text: title font.pointSize: 12 wrapMode: Text.Wrap + width: parent.width } Text { text: excerpt font.pointSize: 9 color: "gray" wrapMode: Text.Wrap + width: parent.width } } } diff --git a/main.qml b/main.qml index f719f47..74fe353 100644 --- a/main.qml +++ b/main.qml @@ -25,18 +25,15 @@ ApplicationWindow { ListView { id: listView - anchors.top: parent.top - anchors.bottom: parent.bottom - spacing: 5 + anchors.fill: parent + spacing: 1 model: server.posts - delegate: PostListItem { - listView: listView - } + delegate: delegate highlight: Rectangle { color: "lightblue" opacity: 0.5 - focus: true } + focus: true } } @@ -65,6 +62,13 @@ ApplicationWindow { id: server } + Component { + id: delegate + PostListItem { + listView: listView + } + } + Component.onCompleted: { if(serverLogin.loggedIn()) { loggedIn();