[PyQt] GraphicsItem, QObject Inheritance problem

Jason H scorp1us at yahoo.com
Thu Oct 1 01:43:03 BST 2009


I am working on a hacked PyQt to play with the new animation features. So this isn't entirely kosher, however.

I have the following:
class AffineItem(QGraphicsItem):
      def __init__(self, ..., parent):
          QGraphicsItem.__init__(self, parent)

class WrappedAffineItem(QObject, AffineItem):
      def __init__(self ...):
          QObject.__init__(self)
          AffineItem.__init__(self, ..., parent)

The WrappedAffineItem needs to declare properties, so I have to inherit QObject.
Here is the traceback of what I am getting:

Traceback (most recent call last):
    i = WrappedAffineTextItem(text, ..., self.items['clipItem'])
  File "C:\Qt\PyQt-win-gpl-4.5.2\Plaza.py" in __init__
    AffineTextItem.__init__(self, '', font, brush, parent)
  File "C:\Qt\PyQt-win-gpl-4.5.2\Plaza.py", line 8, in __init__
    QGraphicsItem.__init__(self, parent)
TypeError: argument 1 of PyQt4.QtCore.QObject() has an invalid type

Help?
Thanks!


      


More information about the PyQt mailing list