FlickableY not 0 when at the top

  • I've been trying to create a scroll bar, and come across this issue

    I have a ListView with 'boundsBehavior: "StopAtBounds"', and I am logging its contentY
    Its model refers to an external data source, which can be refreshed to check if it has changed.
    On the first load it behaves as expected, when at the top of the list the contentY is 0
    But after a refresh the top of the list has a much larger contentY
    However the flickable will still not allow me to scroll off the top of the list, back to 0, so it obviously knows where the content is.
    contentHeight also works as expected.

    Has anyone come across anything like this before? Is there a way to send the content back to 0?
    Or is there a way to get the value of contentY at the top of the list, so I can use it as some kind of offset on my scroll bar?

    Thanks for your help

  • I've done a bit more searching and found that what I should be using is positionViewAtIndex() (http://doc.qt.nokia.com/latest/qml-listview.html#positionViewAtIndex-method ), which I would need to call whenever the position of the scrollbar changes.

    console.log("new flickablePosition = " + newFlickablePosition)
    flickable.positionViewAtIndex(newFlickablePosition, ListView.Beginning)

    But using the index of the item is not compatible with the continuous scrolling of the scroll bar, and I would like to use the scrollbar on any flickable, not just a list.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.