PDA

View Full Version : Lazy population of QAbstractTableModel



superpacko
25th October 2011, 21:37
Hi, i need to display a huge collection of files in a QTableView, but i dont want to load it entirely into memory. I'd would be nice to add items as the QTableView scrolls down or up. How could i do that? i've been googling but i didnt found anything on lazzy population o tables.

What should i do to add items to the model only when the view needs them? When scrolling down should i discard the first rows, and ask for them again when scrolling up?

The data is stored in a IR system.

Thanks!

d_stranz
26th October 2011, 04:04
I think you need to look at QAbstractItemModel::canFetchMore() and fetchMore()

Those methods are designed for incremental filling of a model.