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 in ScrollView is creating delegates for all items, insted of only those visible
QtWS25 Last Chance

ListView in ScrollView is creating delegates for all items, insted of only those visible

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
listviewscrollviewdelegatesvirtualization
3 Posts 2 Posters 1.5k 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.
  • D Offline
    D Offline
    danipellex
    wrote on last edited by
    #1

    Hi all,

    A ListView is showing a model with a large set of data, as the only element of a ScrollView: only visible items have their delegates created. Delegates are creating/destroying as needed. And ListView.cacheBuffer property is available to fine tune the result. Perfect.

    My problem: If my ListView is a part of a composition, and this composition is the content of a ScrollView, then all my items/delegates are created!! The can be too many --> Performance problems. I would like to have delegates creating and destroying as they are entering the visible area of the ScrollView, but i don't know how to do it. Any ideas?

    Thank you
    dani

    OK:

    ScrollView {
           ListView {
                 model: mylargemodel
                 delegate: Item {...} // only visible items/delegates are created: OK
           }
    }
    

    NOT OK:

    ScrollView {
           Item {
                  Item {...}
                  Item {...}
                  ListView {
                        model: mylargemodel
                        delegate: Item {...} // ALL ITEMS ARE CREATED!! THOUSANDS!!
                  }
                  Item {...}
           }
    }
    
    1 Reply Last reply
    0
    • D Offline
      D Offline
      danipellex
      wrote on last edited by
      #2

      I am not finding the way to do this: to have ListView virtualization in all ListView usages.
      Someone is able to undertand why?

      1 Reply Last reply
      0
      • jpnurmiJ Offline
        jpnurmiJ Offline
        jpnurmi
        wrote on last edited by
        #3
        This post is deleted!
        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