[PyQt] Adding methods to C++-created objects

Giovanni Bajo rasky at develer.com
Wed Oct 17 17:43:10 BST 2007


Hello,

I get random crashes from code like this one:

class MyDelegate(QItemDelegate):
     def createEditor(self, *args):
         ed = QItemDelegate.createEditor(self, *args)
         ed.foo = bar  # adding stuff to python instance
         ed.foo2 = lambda: bar
         return ed

     def setModelData(self, editor, model, index):
         print editor.foo   # accessing python stuff added before


I think it's either a PyQt bug or simply this usage pattern is not fully 
supported. If this is something that should work, I'll work on a repro 
recipe.
-- 
Giovanni Bajo



More information about the PyQt mailing list