Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. FlickableY not 0 when at the top
QtWS25 Last Chance

FlickableY not 0 when at the top

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    j_berry
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • J Offline
      J Offline
      j_berry
      wrote on last edited by
      #2

      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.

      @
      onNewFlickablePositionChanged:
      {
      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved