Quote Originally Posted by semoser View Post
I don't keep any items in the model.
That doesn't matter, QDirModel doesn't store any data as well. The model is not for storing data (physically) but for providing a generic interface for outside world.

Data stored in the file (it may be very large file) in some internal format. Model only obtain data offset in that file from QModelIndex row and column and returns data for this row and column.
That's fine - in theory. In practice I believe it is slower than WindowsXP running on 128MB of RAM Imagine you get two subsequent calls for the model:
1. index(0, 0)
2. index(rowCount()-1, 0)

This way you have to go through the whole file (logically, in reality only the right block needs to be accessed if records have constant size) before reading the data.

I think it is correspond to MVC pattern, isn't it?
Yes, it does. But you said you store only that part of data which is visible. And that doesn't correspond to MVC. Especially that now you say you don't store any data

How did you implement rowCount()?

Anyway, the problem with itemviews is that sometimes it like to go through the whole model reading data like crazy. Don't ask me why... someone has recently asked about it, but maybe he was wrong and it is not true that the whole model is scanned as this would seem odd, because the view knows exactly which items it currently displays. The problem might (should?) only occur when using a model proxy as the proxy would have to scan the complete model now and then.

I suggest you at least introduce some caching or indexing and try to run your application under a profiler to see what slows it down the most.

About Excel - it stores all its data in memory or some disk buffers (who knows?), it doesn't scan through the .xls file all the time. If that was the case, you couldn't reference a cell which is currently not visible or it would be slow like hell or cells would have to have constant sizes (as it wouldn't be possible to easily (quickly) determine the offset where particular data is stored).