fix streaming scroll: use Timer.singleShot + positionViewAtIndex
This commit is contained in:
parent
df41aad5cb
commit
50c3b5979c
15
gui/main.qml
15
gui/main.qml
|
|
@ -313,14 +313,23 @@ ApplicationWindow {
|
|||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
onCountChanged: {
|
||||
Qt.callLater(function() { positionViewAtEnd() })
|
||||
if (count > 0) {
|
||||
var idx = count - 1
|
||||
Timer.singleShot(0, function() {
|
||||
positionViewAtIndex(idx, ListView.End)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: chatModel
|
||||
function onDataChanged() {
|
||||
if (chatView.atYEnd)
|
||||
Qt.callLater(function() { chatView.positionViewAtEnd() })
|
||||
if (chatView.atYEnd && chatView.count > 0) {
|
||||
var idx = chatView.count - 1
|
||||
Timer.singleShot(0, function() {
|
||||
chatView.positionViewAtIndex(idx, ListView.End)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in New Issue