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. TreeView and scrolling
Forum Updated to NodeBB v4.3 + New Features

TreeView and scrolling

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 2 Posters 2.8k Views 2 Watching
  • 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.
  • I Offline
    I Offline
    ikit
    wrote on last edited by
    #1

    Hi,
    I would like to implement a lazy loading in my treeview with the scrollindicator.
    I'm wondering how to be notified when the scroll position in my treeview reach the bottom to load next entries ?

    sierdzioS 1 Reply Last reply
    0
    • I ikit

      Hi,
      I would like to implement a lazy loading in my treeview with the scrollindicator.
      I'm wondering how to be notified when the scroll position in my treeview reach the bottom to load next entries ?

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @ikit said in TreeView and scrolling:

      I'm wondering how to be notified when the scroll position in my treeview reach the bottom to load next entries ?

      You don't need to. If you use canFetchMore() and fetchMore() functions, they automatically respond to the scroll bard being close to the bottom.

      (Z(:^

      1 Reply Last reply
      0
      • I Offline
        I Offline
        ikit
        wrote on last edited by ikit
        #3

        Thanks for your answer.

        I tried to implement fetchMore() and canFetchMore, but, the canFetchMore is called only one time, just after the end of the init of my treemodel (when i call endResetModel() instead of the scrollindicator close to the bottom), and then the canFetchMore is no more called... I suppose that Qt assume that I load all remaining entries in the fetchMore...

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          See the example. It definitely does work, I've used it in 2 separate QML projects.

          (Z(:^

          1 Reply Last reply
          1
          • I Offline
            I Offline
            ikit
            wrote on last edited by
            #5

            I checked my code and test again, but I still have the problem. The example use a ListView and not a TreeView. That's probably why the behavior is not the same with me.

            According to the Qt documentation : the fetchMore() method shall do : "Fetches any available data for the items with the parent specified by the parent index." So if I understand well (I'm not fluent in english), it's normal that the fetchMore was called only one time. because this method is supposed to load all sub-entries for the provided item.

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              No, the implementation is entirely up to you. In my code, I used to hardcode it to fetch only 10 more items.

              Perhaps it is like you describe, though. Tree view is a late addition to QtQuick, maybe it is buggy. Unfortunately I can't check now, I'm not at my PC.

              Maybe try calling canFetchMore manually when your tree view reaches the bottom? Flickable should have some slots invoked after scrolling, and you can compare that against contentRect. Sorry again that I won't link to relevant portion of the documentation, I'm writing from my phone and it is a bit tricky ;-)

              (Z(:^

              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