Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QAbstractTableModel data preloading
I'm trying to show large data set in QTableView. Now, I want to preload the data for the all visible rows, instead of reading the data row by row. I've searched the docs but couldn't find the function/signal which could be used. Is something like this possible with QAbstractTableModel or do I need to make the custom QTableView?
There is FetchMore
Hey @mrjj ,
thanks for the quick reply.
I have somehow missed the canFetchMore()/fetchMore(). Now, can I somehow find out which rows and columns are currently visible so I can load the data?
Well the view call canFetchMore() when it needs more data
so not sure you need to manually care about what is visible or not.
As far as I know, if you implement
Then it just works :)
But how do I know how many rows do I need to preload? In the link you posted, the items are loaded in 100 increments. So I may do the same, but this could be ineffective because instead of 1 preload of the all the data I need, I would make 2-3 depending of the height of the view.
Anyway, thanks for the help.
Well You could use
to check if they are shown if you want to optimize that much.
Im not sure how to easy check how many lines visible but
but if you are using fixed row height then its easy to calc with
viewport height and item height.
Ok, will try that.
Thanks again :)