Tree views - Best design practices

Filip Gruszczyński gruszczy at
Thu Jan 8 21:13:37 CET 2009

I'd love to have operations methods, which would return names of
operations and references to proper methods. The problem is that
certain operations require more, than just running some operation on
the Group or Element. Let's say, you want to add new group to an
existing one - you can't do that to an element. But adding a group
cannot be just done by calling group.addGroup. You must first
construct the group or at least get information require to construct a
group, so you must for example call a dialog which will ask for
information about the group. And that's in conflict with model/view

And that's not all. I am using qt and when I want to add this group to
another one, I have to first call beginInsertRows on the model used by
the tree view (it's a layer between the gui and the real model).

I tried building a wrapper around my model which would provide
additional info, but then I had to keep relations between objects in
two places (relations between real groups and elements and wrapper
groups and wrapper elements), which wasn't the right way to do. I just
can figure a simple, elegant way to do this.

Filip Gruszczyński

More information about the Python-list mailing list