feat(ChatMessages): show chat identifier at the top of the window

This commit is contained in:
Jonathan Rainville 2021-04-28 13:15:56 -04:00 committed by Iuri Matias
parent 64e965ea07
commit 49d130a111
1 changed files with 22 additions and 2 deletions

View File

@ -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
}