gui: restore scroll-follow with debounced Timer
Use a 16ms Timer restarted from onContentHeightChanged and onCountChanged. The timer fires after the polish pass completes, avoiding the recursive layout loop that the old synchronous positionViewAtEnd() caused.
This commit is contained in:
parent
3525637d60
commit
eed4a1089e
17
gui/main.qml
17
gui/main.qml
|
|
@ -888,14 +888,23 @@ ApplicationWindow {
|
||||||
|
|
||||||
onCountChanged: {
|
onCountChanged: {
|
||||||
if (followTail)
|
if (followTail)
|
||||||
Qt.callLater(chatView.scrollToEnd)
|
scrollTimer.restart()
|
||||||
|
}
|
||||||
|
|
||||||
|
onContentHeightChanged: {
|
||||||
|
if (followTail)
|
||||||
|
scrollTimer.restart()
|
||||||
}
|
}
|
||||||
|
|
||||||
onMovementEnded: followTail = atYEnd
|
onMovementEnded: followTail = atYEnd
|
||||||
|
|
||||||
function scrollToEnd() {
|
Timer {
|
||||||
if (followTail && contentHeight > height)
|
id: scrollTimer
|
||||||
positionViewAtEnd()
|
interval: 16
|
||||||
|
onTriggered: {
|
||||||
|
if (chatView.followTail && chatView.contentHeight > chatView.height)
|
||||||
|
chatView.positionViewAtEnd()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: ChatBlockDelegate {
|
delegate: ChatBlockDelegate {
|
||||||
|
|
|
||||||
Reference in New Issue