On Sat, Apr 14, 2012 at 09:12, Phil Thompson <p...@riverbankcomputing.com>wrote:
> On Sun, 8 Apr 2012 22:40:04 -0400, Luke Campagnola > <lcamp...@email.unc.edu> > wrote: > >As an example, consider the standard diamond > > inheritance problem: > > > > A > > / \ > > B C > > \ / > > D > > > > If A is a subclass of QObject, then presumably classes B, C, and D could > > all define their own signals (creating an instance of class D should > only > > result in a single C++ QObject instance, so in theory this should work > > fine). > > No, because Qt doesn't support it as it only handles "linear" chains of > meta-objects. > > Thanks, Phil, I didn't realize this was a limitation of Qt. I did find an easy workaround, though: instead of defining class C as a QObject subclass, I just give it a separate QObject attribute as a proxy for sending and receiving signals. Looks like this: class C: class QObjectProxy(QObject): sig = QtCore.pyqtSignal() def __init__(self): self.proxy = QObjectProxy() self.sig = self.proxy.sig Then for instances of class C, I can call c.sig.emit() or c.sig.connect(...) in the usual way and this works well with multiple inheritance. Luke
_______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt