Say I want to implement a QTreeView
that would show the (hierarchical) model of the file system. This model would be populated dynamically, and I would like to keep in-memory data at a minimum.
Naturally, any collapsed folders would not be populated (and I would de-populate them when they are collapsed). But - there might be some folders which are expanded but not in the view (say if we expand a folder and then scroll up in the hierarchy - the folder and its contents will not be displayed).
Is there any way in which I could catch the entering-in-view/exiting-view events (let's say for the folder itself for a beginning). The point being that if the folder (and its contents) is not displayed, I would like to de-populate it internally (free the memory) and when it is displayed again, I would like to re-populate it. Note that I am not looking to collapse
the folder (when you scroll back all would be seemingly as before).
Leaving aside the obvious pitfalls of the small example I presented, is this possible to do? I don't mind extending any of the Qt classes necessary to perform this.
[edit] I know about Qt's filesystem view example, this is something different from what's in there.