Render only visible items.



  • If i have for example ListView with thousands items, i don't want them all to be processed, because it will hurts perfromance.
    I read that i could setup the visible property to false, but i would better do something similiar to when using QPainter to paint items.
    With QPainter if i know that widget height is 100 and i have 1000 items where each has 10px, i can easily to calculate which items to paint based on where scrollbar is, so it is very fast. How to do this in Qt Quick 2? Actually i don't want even to use that QML (i don't want the javascript engine to slow down the app), i wanna to use C++ for everything. I expect some method where i can add to Scene Graphs just items that are visible (which i will calculate based on height etc..), but can't find where to do it.



  • As i went through source code of qdeclarative, i noticed that it is even not possible to add for example text node programatically, so i think best way for me will be to fork qdeclarative so i can use even those private classes and do what i need.


  • Moderators

    @KrabQT Sounds like a good opportunity for QAbstractItemModel with ListView. Re-Implement fetchMore and canFetchMore for incremental model.


Log in to reply
 

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