On 24.05.06 19:38:36, Allen Bierbaum wrote: > On 5/24/06, Andreas Pakulat <[EMAIL PROTECTED]> wrote: > >I don't see why using internalPointer is easier than using internalId. > >IMHO it doesn't matter much wether you do > > > >item = static_cast<TreeItem*>(index.internalPointer()) > >or > >item = self.obj_dict[index.internalId()] > > One reason I am running into in my current code is that once you have > a map of id to objects there is no good way to know when to clear out > the map and thus release the references to the objects.
Hmm, I don't see why that's hard, when your model has a method to set completely new content you can release all your id's and create new ones. If your model instance get's disposed your object-dict will too. > The other "problem" I have run into (and this is not unique to Python) > is that the QT data model requires bi-directional references in the > tree (parents need to know children, and children need to know > parents). Many of the tree models that I need to view only have the > parents knowing the children and don't have the opposite direction. That's why all of my treeitem-classes contain a member variable pointing to the parent. I don't see why this is a problem either. However this 2nd one is not solbed by using pointers instead of Id's, for the pointed-to-objects you still need to get the parent. Andreas -- You are not dead yet. But watch for further reports. _______________________________________________ PyKDE mailing list [email protected] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
