Hi,
I have tried with 'atYEnd' in several property changes, to detect if scroll is at bottom or not
It seems to work, and then I use that in 'onCountChanged' to put (or not) the scroll at the bottom
That works once all the ListView height is full of messages, but NOT in ONE case: when the incoming message is the one that fills the
ListView height (1st time that contentY is NOT '0').
I don't know if it is clear...
I have simplified my code to test (including the delegate), and now it seems like that:
FocusScope {
clip: true
id: focusScopeView
width: parent.width; height: parent.height
ScrollView {
width: parent.width; height: parent.height
ListView {
id: listTexts
width: parent.width; height: parent.height
property bool bScrolled: false
model: textsModel
delegate: Text { text: "Text:\t" + eventText }
onCountChanged: {
if (!bScrolled)
positionViewAtEnd();
}
onContentYChanged: {
bScrolled = !atYEnd;
if (atYEnd)
positionViewAtEnd()
}
onContentHeightChanged: {
if (!bScrolled)
positionViewAtEnd();
}
}
}
}
FocusScope {
clip: true
id: focusScopeView
width: parent.width; height: parent.height
ScrollView {
width: parent.width; height: parent.height
ListView {
id: listTexts
width: parent.width; height: parent.height
property bool bScrolled: false
model: textsModel
delegate: Text { text: "Text:\t" + eventText }
onCountChanged: {
if (!bScrolled)
positionViewAtEnd();
}
onContentYChanged: {
bScrolled = !atYEnd;
if (atYEnd)
positionViewAtEnd()
}
onContentHeightChanged: {
if (!bScrolled)
positionViewAtEnd();
}
}
}
}
To copy to clipboard, switch view to plain text mode
Thanks and regards!
Diego
Bookmarks