Thanks Brian, but I don't understand that. If it is derived from a non-object, 
how does the connect work?

I went with the reverse approach: 
class ObjWrapper(QObject):
    def __init__(self, item):
        QObject.__init__(self)
        self.item=item
... then provide the properties, signals/slots, which all operate on self.item 
...

It would be handy if these approaches were discussed in the docs.



________________________________
From: Brian Kelley <[email protected]>
To: Jason H <[email protected]>
Cc: "[email protected]" <[email protected]>
Sent: Thursday, October 1, 2009 8:16:52 AM
Subject: Re: [PyQt] GraphicsItem, QObject Inheritance problem

Re: [PyQt] GraphicsItem, QObject Inheritance problem What you can do, however, 
is to make a QObject delegate like:

class WrappedAffineItem(AffineItem):
       def __init__(self ...):
           self.qobject = QObject(self)
           AffineItem.__init__(self, ..., parent)
           self.qobject.connect(self.qobject, 
                                SIGNAL("mysignal(int)",
                                SLOT(self.dosomething))

       def connect(self, *a, *kw):
           self.qobject.connect(*a,**kw)

       def soSomething(self, *a):
           pass

Brian Kelley 


      
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to