Simplify timeline structure and fix text wrapping bug

This commit is contained in:
Carl Schwan
2020-10-04 10:46:48 +02:00
parent 88ea6f2ea1
commit 81563c056f
3 changed files with 55 additions and 74 deletions

View File

@@ -25,10 +25,12 @@ RowLayout {
id: root id: root
spacing: Kirigami.Units.largeSpacing spacing: Kirigami.Units.largeSpacing
Layout.leftMargin: Kirigami.Units.smallSpacing
Layout.rightMargin: Kirigami.Units.smallSpacing
Kirigami.Avatar { Kirigami.Avatar {
Layout.preferredWidth: Kirigami.Units.gridUnit * 1.5 Layout.preferredWidth: Kirigami.Units.gridUnit * 2
Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5 Layout.preferredHeight: Kirigami.Units.gridUnit * 2
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
@@ -39,37 +41,15 @@ RowLayout {
} }
Item { Item {
Layout.preferredWidth: Kirigami.Units.gridUnit * 1.5 Layout.preferredWidth: Kirigami.Units.gridUnit * 2
Layout.preferredHeight: 1 Layout.preferredHeight: 1
visible: !showAuthor visible: !showAuthor
} }
Item {
Layout.preferredWidth: column.width + 16
Layout.preferredHeight: column.height + 16
/*RectangularGlow {
anchors.fill: messageBubble
glowRadius: 0.8
spread: 0.3
cornerRadius: messageBubble.radius + glowRadius
color: Qt.darker(messageBubble.color, 1.2)
}*/
// inner area of the message bubble
/*Rectangle {
id: messageBubble
anchors.fill: parent
radius: 2
color: authorColor
}*/
ColumnLayout { ColumnLayout {
id: column id: column
Layout.fillWidth: true Layout.fillWidth: true
anchors.centerIn: parent
spacing: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing
Controls.Label { Controls.Label {
@@ -122,16 +102,15 @@ RowLayout {
text: replyVisible ? reply.display : "" text: replyVisible ? reply.display : ""
color: Kirigami.Theme.textColor color: Kirigami.Theme.textColor
// selectionColor: Kirigami.Theme.highlightColor // selectionColor: Kirigami.Theme.highlightColor
// selectedTextColor: Kirigami.Theme.highlightedTextColor // selectedTextColor: Kirigami.Theme.highlightedTextColor
// selectByMouse: true // selectByMouse: true
// readOnly: true // readOnly: true
wrapMode: Text.WrapAtWordBoundaryOrAnywhere wrapMode: Text.WrapAtWordBoundaryOrAnywhere
textFormat: Text.RichText textFormat: Text.RichText
} }
} }
} }
} }
}
} }

View File

@@ -16,7 +16,8 @@ Text {
// selectByMouse: true // selectByMouse: true
// readOnly: true // readOnly: true
wrapMode: Text.WrapAtWordBoundaryOrAnywhere wrapMode: Text.WordWrap
width: parent.width
textFormat: Text.RichText textFormat: Text.RichText
} }

View File

@@ -190,6 +190,7 @@ Kirigami.ScrollablePage {
innerObject: MessageDelegate { innerObject: MessageDelegate {
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumWidth: messageListView.width
innerObject: TextDelegate { innerObject: TextDelegate {
Layout.fillWidth: true Layout.fillWidth: true