[PyKDE] MVC Question

Andreas Pakulat apaku at gmx.de
Fri Oct 6 20:19:27 BST 2006


On 06.10.06 10:14:17, Matt Chambers wrote:
> Thanks, that works but then then any branches you have open in the tree view 
> closed.   I guess there is no way to maintain
> the open/close status of existing branches, and default new ones to open?

Hmm, there's API to set the status of a given model index to expanded
(in QTreeView), you'd have to store the indexes that are expanded.

But I think there's no way to have new tree items opened by default,
other than calling setExpanded after inserting new items. 

But generally emitting modelReset() signal means the model's data
completely changed and thus the view drops all information it stores.

If you only want to insert a new node into the model, write functions
that call beginInsertRows/endInsertRows. For more information see the
Qt4 docs, there a chapter about model/view. 

Andreas

-- 
Chicken Little only has to be right once.




More information about the PyQt mailing list