feat: Add navigation panel for messages

This commit is contained in:
Petr Mironychev
2025-10-11 18:02:08 +02:00
parent 906c161729
commit 8d495dd1bf
4 changed files with 86 additions and 2 deletions

View File

@ -81,6 +81,17 @@ ChatRootView {
checked: typeof _chatview !== 'undefined' ? _chatview.isPin : false
onCheckedChanged: _chatview.isPin = topBar.pinButton.checked
}
navigation.currentMessageNumber: {
return "%1/%2".arg(chatListView.currentIndex + 1).arg(chatListView.count)
}
navigation.onMessageUp: {
const newIndex = Math.max(0, chatListView.currentIndex - 1)
chatListView.positionViewAtIndex(newIndex, ListView.Center)
}
navigation.onMessageDown: {
const newIndex = Math.min(chatListView.count - 1, chatListView.currentIndex + 1)
chatListView.positionViewAtIndex(newIndex, ListView.Center)
}
}
ListView {
@ -95,7 +106,6 @@ ChatRootView {
boundsBehavior: Flickable.StopAtBounds
cacheBuffer: 2000
delegate: Loader {
required property var model
required property int index
@ -124,6 +134,13 @@ ChatRootView {
}
}
onContentYChanged: {
const index = indexAt(width / 2, contentY + height / 2)
if (index !== -1) {
currentIndex = index
}
}
Component {
id: chatItemComponent