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. ListView animation while prefetching

ListView animation while prefetching

Scheduled Pinned Locked Moved QML and Qt Quick
fetchingprefetchingqmllistview
1 Posts 1 Posters 597 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.
  • A Offline
    A Offline
    Ayelet Cohen
    wrote on 11 Aug 2015, 06:55 last edited by Ayelet Cohen 8 Nov 2015, 09:45
    #1

    Hello,

    The problem
    I'm trying to create a ListView that the user can scroll infinitely, by fetching more and more data on the background.
    The problem is that whenever I add new items to the model, the scrolling animation "jumps" and then continues.
    I want to get rid of that glitch.

    What I have
    I have a vertical ListView which the user can scroll using Up/Down keyboard keys.
    Scrolling is done with animation (item X moves to position X+1 with animation) - the standard ListView animation that happens when you set highlightRangeMode: ListView.StrictlyEnforceRange.

    The model is written in C++ (inheriting from QAbstractListModel), and is prefetching new data as the view progress through the end of model:

    1. When data() is called, and the index is close to the end of the model, it goes to the server to bring more items. It appends the new items to the model, but does not report anything to the view, and *rowCount() * also doesn't reflect the new size of the model.
    2. On *canFetchMore() * it returns true if we have already prefetched items that were added to the model but not reported to the view.
    3. On fetchMore() it calls beginInsertRows, update the row count to reflect the new items insertion, and calls endInsertRows.

    If code is needed to be inspected, let me know.

    Thanks a lot!
    Ayelet.

    1 Reply Last reply
    0

    1/1

    11 Aug 2015, 06:55

    • Login

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