FeedTheMonkey/qml/PostListItem.qml
2016-07-20 17:32:33 +02:00

88 lines
2.7 KiB
QML

import QtQuick 2.0
import QtQuick.Controls 1.3
Item {
property int textFontSize: 14
property int smallfontSize: 11
property bool nightmode
Component.onCompleted: fixFontSize()
onTextFontSizeChanged: fixFontSize()
function fixFontSize() {
smallfontSize = textFontSize * 0.8
}
id: item
height: column.height + 20
width: parent.parent.parent.width
Item {
anchors.fill: parent
Item {
anchors.fill: parent
anchors.leftMargin: 15
anchors.rightMargin: 15
anchors.topMargin: 10
anchors.bottomMargin: 10
Column {
id: column
width: parent.width
Row {
spacing: 10
Label {
text: feedTitle
font.pointSize: smallfontSize
textFormat: Text.PlainText
color: nightmode ? "#888" : "gray"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
renderType: Text.NativeRendering
}
Label {
text: date.toLocaleString(Qt.locale(), Locale.ShortFormat)
font.pointSize: smallfontSize
textFormat: Text.PlainText
color: nightmode ? "#888" : "gray"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
renderType: Text.NativeRendering
}
}
Label {
text: title
color: nightmode ? (read ? "#888" : "#aaa") : (read ? "gray" : "black")
font.pointSize: textFontSize
textFormat: Text.RichText
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
renderType: Text.NativeRendering
width: parent.width
}
Label {
text: excerpt
font.pointSize: smallfontSize
textFormat: Text.RichText
color: nightmode ? "#888" : "gray"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
renderType: Text.NativeRendering
width: parent.width
}
}
}
Rectangle {
anchors.top: parent.bottom
width: parent.width
height: 1
color: nightmode ? "#222" : "lightgray"
}
}
MouseArea {
anchors.fill: parent
onClicked: {
parent.parent.parent.currentIndex = index
}
}
}