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



  • 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 {...}
           }
    }
    


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



  • This post is deleted!


Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.