forked from blue/squawk
experimenting with qml
This commit is contained in:
parent
38159eafeb
commit
4e6bd04b02
13 changed files with 176 additions and 69 deletions
79
resources/qml/feed.qml
Normal file
79
resources/qml/feed.qml
Normal file
|
@ -0,0 +1,79 @@
|
|||
import QtQuick 2.14
|
||||
import QtQuick.Controls 2.14
|
||||
import QtQuick.Layouts 1.14
|
||||
|
||||
ListView {
|
||||
id: list
|
||||
verticalLayoutDirection: ListView.BottomToTop
|
||||
|
||||
required model
|
||||
|
||||
delegate: RowLayout {
|
||||
id: root
|
||||
width: ListView.view.width
|
||||
|
||||
// placeholder
|
||||
Item {
|
||||
Layout.preferredWidth: root.layoutDirection === Qt.LeftToRight ? 5 : 10
|
||||
}
|
||||
|
||||
// Avatar {
|
||||
// id: avatar
|
||||
// visible: !sentByMe
|
||||
// avatarUrl: root.avatarUrl
|
||||
// Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
||||
// name: root.senderName
|
||||
// Layout.preferredHeight: Kirigami.Units.gridUnit * 2.2
|
||||
// Layout.preferredWidth: Kirigami.Units.gridUnit * 2.2
|
||||
// }
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: content.width + 16
|
||||
Layout.preferredHeight: content.height + 16
|
||||
|
||||
Rectangle {
|
||||
id: messageBubble
|
||||
anchors.fill: parent
|
||||
|
||||
color: "blue"
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: content
|
||||
spacing: 5
|
||||
anchors.centerIn: parent
|
||||
|
||||
Label {
|
||||
text: model.sender
|
||||
}
|
||||
|
||||
Label {
|
||||
text: model.text
|
||||
wrapMode: Text.Wrap
|
||||
Layout.maximumWidth: root.width
|
||||
}
|
||||
|
||||
// message meta data: date, deliveryState
|
||||
RowLayout {
|
||||
Layout.bottomMargin: -4
|
||||
|
||||
Label {
|
||||
id: dateLabel
|
||||
text: model.date
|
||||
}
|
||||
|
||||
// Icon {
|
||||
// source: "edit-symbolic"
|
||||
// visible: model.correction
|
||||
// Layout.preferredHeight: 10
|
||||
// Layout.preferredWidth: 10
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -160,5 +160,7 @@
|
|||
<file>images/fallback/light/small/favorite.svg</file>
|
||||
<file>images/fallback/light/small/unfavorite.svg</file>
|
||||
<file>images/fallback/light/small/add.svg</file>
|
||||
|
||||
<file>qml/feed.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue