From 49d130a111e2cc38c13db452a2f105fc48ff912f Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 28 Apr 2021 13:15:56 -0400 Subject: [PATCH] feat(ChatMessages): show chat identifier at the top of the window --- .../Chat/ChatColumn/ChatMessages.qml | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml b/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml index d17a7c929d..b91ddf3079 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml @@ -63,10 +63,30 @@ ScrollView { } return 10000 } - Layout.fillWidth: true - Layout.fillHeight: true verticalLayoutDirection: ListView.BottomToTop + // This header and Connections is to create an invisible padding so that the chat identifier is at the top + // The Connections is necessary, because doing the check inside teh ehader created a binding loop (the contentHeight includes the header height + // If the content height is smaller than the full height, we "show" the padding so that the chat identifier is at the top, otherwise we disable the Connections + header: Item { + height: 0 + width: chatLogView.width + } + Connections { + id: contentHeightConnection + enabled: true + target: chatLogView + onContentHeightChanged: { + if (chatLogView.contentItem.height - chatLogView.headerItem.height < chatLogView.height) { + chatLogView.headerItem.height = chatLogView.height - (chatLogView.contentItem.height - chatLogView.headerItem.height) - 36 + } else { + chatLogView.headerItem.height = 0 + contentHeightConnection.enabled = false + } + } + } + + Timer { id: timer }