Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QListView lazy load

I have implemented a QListView with item model. And everything goes well until it has going not well when I have > 1000 data on it.

It slow in the first loading. After I check it on the model actually QListView load everything from the first time instead of load only the one that displayed. I already set layout mode to batched and set the batch size to 100. But seems it does not work, it still load all data from the first. Is there anything I can optimized it, something like lazy load (only load that visible on list view)?

Update: The data was load from SQLITE and the Icon directly load from HDD. For the Icon, I have cached it once loaded.

Another question is : is it possible to make it load unload? My application now stand about 100Mb of RAM because need to load a lot of image that use on the QListView. And it possible to increase because the image is not complete yet today.

like image 974
Apin Avatar asked Mar 30 '26 15:03

Apin


1 Answers

I think I can contribute here!

Perhaps what you need is listView->setUniformItemSizes(true)

(With this set to true, the QListView does not need to preload all items to plan the scroll bar size and position etc)

like image 196
markv Avatar answered Apr 02 '26 14:04

markv