PDA

View Full Version : Need help with QTableView/QTableWidget and large data



aguayro
28th June 2012, 23:13
Hi, i'm writing an emulator frontend, so i need handle with large amounts of data ( MAME romset is 10000+ files ).
The rom listing part need to be fast, fill a table with 10000+ rows and 5 or 6 columns. I've seen some frontends doing this almost intantly.
i've tried some like:
for(0-15000) {
addrow;
read a line from game list file (text)
additems of each column;
}

but its little slow, 3-5 seconds, nothing to do against that "instantly listing frontends".
i'm no sure if its a problem of my method, or it's not possible do this almost instantly with Qt, or if i must use QLIstView/Model instead of QTableWidget...
i'm a novice autodidact programmer, so beg for some help.
Thanks!

PD: sorry for my english

ChrisW67
29th June 2012, 05:36
The way long lists are generally handled is called lazy loading. Only the small number of rows of data needed to draw what is visible is loaded at initial display. As the user scrolls down the list more rows are loaded to cover what is displayed. QSqlTableModel does this sort of thing, loading only the first 255 rows until such time as later rows are requested. Often is possible to ensure the items most likely to be required are in the first batch fetched or a filter mechanism is used to shorten the list... the user never scrolls and the other rows are never fetched.

aguayro
29th June 2012, 13:09
Seems a good idea, i never noticed about that, thanks!!
i'll try it.

after some investigation, it's seems QTableView does lazy loading automatically, is this true?