forked from jeena/FeedTheMonkey
zebra list
This commit is contained in:
parent
218f556a98
commit
19e5a02d6e
4 changed files with 89 additions and 67 deletions
107
PostListItem.qml
107
PostListItem.qml
|
@ -1,58 +1,69 @@
|
|||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
property ListView listView
|
||||
Component {
|
||||
id: component
|
||||
Item {
|
||||
id: item
|
||||
height: column.height + 20
|
||||
width: parent.parent.parent.width
|
||||
|
||||
height: column.height + 10
|
||||
width: parent.parent.parent.width
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 10
|
||||
anchors.rightMargin: 10
|
||||
anchors.topMargin: 5
|
||||
anchors.bottomMargin: 5
|
||||
color: "transparent"
|
||||
|
||||
Column {
|
||||
id: column
|
||||
width: parent.width
|
||||
|
||||
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
|
||||
}
|
||||
Rectangle {
|
||||
property variant colors: ["#AAFFFFFF", "transparent"]
|
||||
anchors.fill: parent
|
||||
color: {
|
||||
if(item.ListView.isCurrentItem) return "transparent"
|
||||
return colors[index % 2]
|
||||
}
|
||||
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
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 15
|
||||
anchors.rightMargin: 15
|
||||
anchors.topMargin: 10
|
||||
anchors.bottomMargin: 10
|
||||
color: "transparent"
|
||||
|
||||
Column {
|
||||
id: column
|
||||
width: parent.width
|
||||
|
||||
Row {
|
||||
spacing: 10
|
||||
Text {
|
||||
text: feedTitle
|
||||
font.pointSize: 12
|
||||
color: "gray"
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
Text {
|
||||
text: date.toLocaleString(null)
|
||||
font.pointSize: 12
|
||||
color: "gray"
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: title
|
||||
font.pointSize: 16
|
||||
wrapMode: Text.Wrap
|
||||
width: parent.width
|
||||
}
|
||||
Text {
|
||||
text: excerpt
|
||||
font.pointSize: 12
|
||||
color: "gray"
|
||||
wrapMode: Text.Wrap
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
parent.parent.parent.currentIndex = index
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
parent.parent.parent.currentIndex = index
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue