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. QML ListView: Load data portion. How?
Forum Updated to NodeBB v4.3 + New Features

QML ListView: Load data portion. How?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
7 Posts 2 Posters 955 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.
  • B Offline
    B Offline
    bogong
    wrote on last edited by
    #1

    Hello all!

    Is in ListView any option to load into ListModel data by portions? For example I have 2000 rows in DB, but on device in one screen without scrolling only 10 and a few in memory because of chacheBuffer. In following of documentation whole amount of data should be in LitModel? Am I right? Is the option to load into ListView model data portion by portion?

    If ListView has no any data handlers for loading portion-by-portion, which QML Component will be OK with this issue?

    J.HilkJ 1 Reply Last reply
    0
    • B bogong

      Hello all!

      Is in ListView any option to load into ListModel data by portions? For example I have 2000 rows in DB, but on device in one screen without scrolling only 10 and a few in memory because of chacheBuffer. In following of documentation whole amount of data should be in LitModel? Am I right? Is the option to load into ListView model data portion by portion?

      If ListView has no any data handlers for loading portion-by-portion, which QML Component will be OK with this issue?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @bogong

      for partial loading data one is supposed to use
      https://doc.qt.io/qt-5/qabstractitemmodel.html#canFetchMore
      and
      https://doc.qt.io/qt-5/qabstractitemmodel.html#fetchMore


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      B 1 Reply Last reply
      3
      • J.HilkJ J.Hilk

        @bogong

        for partial loading data one is supposed to use
        https://doc.qt.io/qt-5/qabstractitemmodel.html#canFetchMore
        and
        https://doc.qt.io/qt-5/qabstractitemmodel.html#fetchMore

        B Offline
        B Offline
        bogong
        wrote on last edited by
        #3

        @J-Hilk Am I right - I need to develop my own "ListModelImplementation" based on QAbstractItemModel and attach it to ListView?

        J.HilkJ 1 Reply Last reply
        0
        • B bogong

          @J-Hilk Am I right - I need to develop my own "ListModelImplementation" based on QAbstractItemModel and attach it to ListView?

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by J.Hilk
          #4

          @bogong yes, those functions are pure virtual and you need to provide/override them, when you create your "ListModelImplementation"


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          B 1 Reply Last reply
          2
          • J.HilkJ J.Hilk

            @bogong yes, those functions are pure virtual and you need to provide/override them, when you create your "ListModelImplementation"

            B Offline
            B Offline
            bogong
            wrote on last edited by
            #5

            @J-Hilk Is there example of it?

            J.HilkJ 1 Reply Last reply
            0
            • B bogong

              @J-Hilk Is there example of it?

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by J.Hilk
              #6

              @bogong https://doc.qt.io/qt-5/qtwidgets-itemviews-fetchmore-example.html
              doesn't matter if the view is QWidget or QML, the model should work for both


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              B 1 Reply Last reply
              2
              • J.HilkJ J.Hilk

                @bogong https://doc.qt.io/qt-5/qtwidgets-itemviews-fetchmore-example.html
                doesn't matter if the view is QWidget or QML, the model should work for both

                B Offline
                B Offline
                bogong
                wrote on last edited by
                #7

                @J-Hilk Thx a lot.

                1 Reply Last reply
                1

                • Login

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