Unsolved how do I load massive table views instantly?
-
say i have a few "playlists" that are really big, like 200k items, with many columns
i'd like to be able to switch to them and have them be instantly loaded.by that i mean the entire list, such that i can take the scroll thumb and drag it to the bottom and see the last item, ie: no "loading by pages"
alternately, if "loading only what you see" is just "how it's done", then can i just set the scroll bar height to be the total height? so the user CAN still grab the scroll thumb, and drag it to the end, and see the data at the end, without waiting for all the unseen data to load?
i know other apps do this... how is it done?
-dave
-
Usually the heavy part is calculating the row heights, so if you're willing to set uniform row heights that should help.
-
If you would like to display/load only what is visible while its visible try this code, at beginning you can set up overall list size, but could allocate the rows only if they become visible.
Buit it will make sorting not work correct until all loaded.QModelIndex firstVisible = ui->list->indexAt(QPoint(0,0)); if(firstVisible.row()>=0){ int lastIndex; int firstIndex; if(loadAll){ firstIndex=0; lastIndex=ui->list->rowCount()-1; }else{ firstIndex=firstVisible.row(); QModelIndex lastVisible = ui->list->indexAt(QPoint(0,ui->list->size().height())); if(lastVisible.row()==-1){ lastIndex=ui->list->rowCount()-1; }else{ lastIndex=lastVisible.row(); } }
-
sorting must work correctly, so that's not an option, right?
-
Create your data structures in another thread and move them all into the model once ready. Or directly create a model in a separate switch and set this once it's filled up.