jeremy at jeremysanders.net
Mon Apr 25 10:05:17 BST 2011
Hi - I've hit several crashes with Qt's model code with PyQt.
Can someone clear up the ownership rules for objects given to
QAbstractItemModel.createIndex and accessed with
I tried creating a layer of indirection when using createIndex, e.g.
def __init__(self, realobj):
self.realobj = realobj
self.createIndex(row, col, Indirect(realobj))
This breaks rather horribly. The objects returned by internalPointer can be
completely random (the model index is however valid), with a different type.
Is because PyQt uses some sort of python id, which is reallocated by python
because the Indirector has no references to it?
I suppose I will have to hack something like storing a reference to the
Indirect object in the realobj.
More information about the PyQt