[Qt-interest] Lazy tree expansion

Jugdish jugdizh at gmail.com
Wed Apr 7 14:11:25 CEST 2010


I have a tree-based model/view framework that talks to an sql database and
does lazy population using the hasChildren() / canFetchMore() / fetchMore()
methods. One issue I'm running into is how to deal with the expandAll()
method on a QTreeView. The problem is that expanding all items could
potentially result in thousands of sql queries at once, as fetchMore() is
called on every item.

Is there any way to do lazy-expansion? So when the user triggers the
"expandAll" action, instead of acting on it immediately, the view only
expands the items currently visible in the viewport, and doesn't expand
others until they are scrolled to. What would be the best way to implement
something like this?

Thanks for your help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100407/c7b6d061/attachment.html 


More information about the Qt-interest-old mailing list