How to implement Lazy Loading in QTreeView (QTableView) or something similar (model with 100k items)
Does any one know how to implement lazy loading with QTreeView? Or how to implement something like QListView::setLayoutMode(QListView::Batched)?
I have a treeView with over 100k items and dragging the vertical scrollbar makes the aplication freeze.
(Or maybe there is something like that for QTableView? It would be possible to switch to a tableView)
Have any one dealt with such problem before?
Google is silent in this matter..
As far as I know, you can do that via a custom model overriding QAbstractItemModel::canFetchMore()
and QAbstractItemModel::fetchMore() for your model.
There is also a official sample.
I have tried the example on a folder with almost 11000 elements (folder with icons and links to those icons), and all it does is to fetch more data, when I scroll through the list, but still slowing down.
I think that my subclassed QTreeView does the same, but witch the example, the scrollbar doesn't represent the actual size of the list, and in my app it does.
Also, I think that (I don't know how, but) my view is being drawn faster, than the example.
Is there a way, to draw in the View only what is visable? I mean that when an Item leaves the View, I don't want it to be drawn, because the model will be updated quite often.