zebra list

This commit is contained in:
Jeena 2015-02-03 21:41:37 +01:00
parent 218f556a98
commit 19e5a02d6e
4 changed files with 89 additions and 67 deletions

View file

@ -1,17 +1,26 @@
import QtQuick 2.0 import QtQuick 2.0
Component {
id: component
Item { Item {
property ListView listView id: item
height: column.height + 20
height: column.height + 10
width: parent.parent.parent.width width: parent.parent.parent.width
Rectangle { Rectangle {
property variant colors: ["#AAFFFFFF", "transparent"]
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: 10 color: {
anchors.rightMargin: 10 if(item.ListView.isCurrentItem) return "transparent"
anchors.topMargin: 5 return colors[index % 2]
anchors.bottomMargin: 5 }
Rectangle {
anchors.fill: parent
anchors.leftMargin: 15
anchors.rightMargin: 15
anchors.topMargin: 10
anchors.bottomMargin: 10
color: "transparent" color: "transparent"
Column { Column {
@ -22,32 +31,33 @@ Item {
spacing: 10 spacing: 10
Text { Text {
text: feedTitle text: feedTitle
font.pointSize: 9 font.pointSize: 12
color: "gray" color: "gray"
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }
Text { Text {
text: date.toLocaleString(null) text: date.toLocaleString(null)
font.pointSize: 9 font.pointSize: 12
color: "gray" color: "gray"
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }
} }
Text { Text {
text: title text: title
font.pointSize: 12 font.pointSize: 16
wrapMode: Text.Wrap wrapMode: Text.Wrap
width: parent.width width: parent.width
} }
Text { Text {
text: excerpt text: excerpt
font.pointSize: 9 font.pointSize: 12
color: "gray" color: "gray"
wrapMode: Text.Wrap wrapMode: Text.Wrap
width: parent.width width: parent.width
} }
} }
} }
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@ -56,3 +66,4 @@ Item {
} }
} }
} }
}

View file

@ -31,13 +31,17 @@ ScrollView {
spacing: 1 spacing: 1
model: item.server.posts model: item.server.posts
delegate: Component { delegate: PostListItem {}
PostListItem {}
}
highlight: Rectangle { highlightFollowsCurrentItem: false
highlight: Component {
Rectangle {
width: listView.currentItem.width
height: listView.currentItem.height
color: "lightblue" color: "lightblue"
opacity: 0.5 opacity: 0.5
y: listView.currentItem.y
}
} }
onCurrentItemChanged: { onCurrentItemChanged: {

View file

@ -1,37 +1,43 @@
body { body {
font-family: "Ubuntu", "Lucida Grande", "Tahoma", sans-serif; font-family: sans-serif;
padding: 1em 2em 1em 2em; padding: 1em 1.5em;
background: transpatent; font-weight: lighter;
} background: #eee;
body.darwin {
font-family: "LucidaGrande", sans-serif;
} }
h1 { h1 {
font-weight: normal; font-weight: lighter;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
header {
margin-bottom: 1em; #date:not(:empty) {
border-bottom: 1px solid #aaa; border-bottom: 1px solid #aaa;
margin-bottom: 1em;
padding-bottom: 1em; padding-bottom: 1em;
display: block;
} }
.starred:after { .starred:after {
content: "*"; content: "*";
} }
header p { header p {
color: #aaa; color: #aaa;
margin: 0; margin: 0;
padding: 0 padding: 0
} }
a { a {
color: #772953; color: #333;
text-decoration: none; text-decoration: none;
} }
img { img {
max-width: 100%; max-width: 100%;
height: auto; height: auto;
} }
article { article {
line-height: 1.6; line-height: 1.6;
} }

View file

@ -24,6 +24,7 @@ ApplicationWindow {
SplitView { SplitView {
anchors.fill: parent anchors.fill: parent
orientation: Qt.Horizontal orientation: Qt.Horizontal
visible: serverLogin.loggedIn()
Sidebar { Sidebar {
id: sidebar id: sidebar
@ -41,7 +42,7 @@ ApplicationWindow {
Login { Login {
id: login id: login
anchors.fill: parent anchors.fill: parent
visible: true visible: !serverLogin.loggedIn()
function login() { function login() {
serverLogin.login(serverUrl, userName, password) serverLogin.login(serverUrl, userName, password)