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
Item {
property ListView listView
height: column.height + 10
Component {
id: component
Item {
id: item
height: column.height + 20
width: parent.parent.parent.width
Rectangle {
property variant colors: ["#AAFFFFFF", "transparent"]
anchors.fill: parent
anchors.leftMargin: 10
anchors.rightMargin: 10
anchors.topMargin: 5
anchors.bottomMargin: 5
color: {
if(item.ListView.isCurrentItem) return "transparent"
return colors[index % 2]
}
Rectangle {
anchors.fill: parent
anchors.leftMargin: 15
anchors.rightMargin: 15
anchors.topMargin: 10
anchors.bottomMargin: 10
color: "transparent"
Column {
@ -22,32 +31,33 @@ Item {
spacing: 10
Text {
text: feedTitle
font.pointSize: 9
font.pointSize: 12
color: "gray"
wrapMode: Text.Wrap
}
Text {
text: date.toLocaleString(null)
font.pointSize: 9
font.pointSize: 12
color: "gray"
wrapMode: Text.Wrap
}
}
Text {
text: title
font.pointSize: 12
font.pointSize: 16
wrapMode: Text.Wrap
width: parent.width
}
Text {
text: excerpt
font.pointSize: 9
font.pointSize: 12
color: "gray"
wrapMode: Text.Wrap
width: parent.width
}
}
}
}
MouseArea {
anchors.fill: parent
@ -55,4 +65,5 @@ Item {
parent.parent.parent.currentIndex = index
}
}
}
}

View file

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

View file

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

View file

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