summary refs log tree commit diff
path: root/resources/qml/TimelineDefaultMessageStyle.qml
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2024-01-08 00:21:42 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2024-01-08 00:21:42 +0100
commit87c063b112b8c7dc1a858af8406008da48b5260b (patch)
tree424f374bcdc9e4866155ccd2fe587c9aa234abb4 /resources/qml/TimelineDefaultMessageStyle.qml
parentFaster blurhash decode (diff)
downloadnheko-87c063b112b8c7dc1a858af8406008da48b5260b.tar.xz
Speedup room switching by forcing a bigger initial item size
Diffstat (limited to 'resources/qml/TimelineDefaultMessageStyle.qml')
-rw-r--r--resources/qml/TimelineDefaultMessageStyle.qml4
1 files changed, 3 insertions, 1 deletions
diff --git a/resources/qml/TimelineDefaultMessageStyle.qml b/resources/qml/TimelineDefaultMessageStyle.qml
index a4466442..55c62b02 100644
--- a/resources/qml/TimelineDefaultMessageStyle.qml
+++ b/resources/qml/TimelineDefaultMessageStyle.qml
@@ -11,7 +11,9 @@ TimelineEvent {
     id: wrapper
     ListView.delayRemove: true
     width: chat.delegateMaxWidth
-    height: Math.max((section.item?.height ?? 0) + gridContainer.implicitHeight + reactionRow.implicitHeight + unreadRow.height, 10)
+    // We return a larger size for any item but the most bottom one, if it isn't initialized yet, since otherwise Qt will create way too many items.
+    // If we did that also for the first item, it would mess with the scroll location a bit, so we don't do it for that item.
+    height: Math.max((section.item?.height ?? 0) + ((gridContainer.implicitHeight < 1 && index != 0) ? 100 : gridContainer.implicitHeight) + reactionRow.implicitHeight + unreadRow.height, 10)
     anchors.horizontalCenter: ListView.view.contentItem.horizontalCenter
     //room: chatRoot.roommodel