[Interest] QTreeView expand/expandAll performance

William Hallatt goblincoding at gmail.com
Fri Sep 26 15:33:00 CEST 2014


Hi everyone,

I have just started playing with Qt’s MVC classes and have created a
hierarchical model to display in a QTreeView. Some of the nodes, however,
have a fair amount of children and when I expand these nodes (or, heaven
forbid, expandAll), the app hangs for a remarkably long time.

I have read everything I can on lazy model loading and have implemented
what I believe to be correct fetchMore and canFetchMore methods, yet this
does not seem to make a difference since fetchMore only gets called once on
an expand (however, the tree expands to the correct level and to the very
last child which I find very confusing).

So, my questions are:

1. Does lazy model loading actually affect the expansion of nodes?
2. Is there a way I could improve the performance?

I have been banging my head against this for two days now so any help will
be appreciated.

The code for my item and model classes is available here:

https://www.dropbox.com/sh/8vc1s29wvmvpp07/AAChJVKhjUuXJy9dxjlT6ErRa?dl=0

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140926/a3cbc160/attachment.html>


More information about the Interest mailing list