[PyQt] Fwd: Mixin classes and PyQt4

Martin Teichmann martin.teichmann at gmail.com
Thu Feb 13 18:54:42 GMT 2014

Hi Baz, Hi Phil, Hi List,

This actually only relates to multiple-inheritance. It should never be
> problem for true mixin classes.

There you're certainly right. It's calling super() where I have my
issues. Your examples did not call super(), so the MRO doesn't

> The one genuine issue with mixins in PyQt, is that you cannot inherit
> custom signals.

Then it might be interesting for you that with my patch applied, it
does work. For example:

from PyQt4.QtGui import QWidget, QLabel, QApplication
from PyQt4.QtCore import pyqtSignal, QObject

class A(QObject):
    a = pyqtSignal(str)

class B(A, QLabel):
    b = pyqtSignal(str)

class Printer(QObject):
    def print(self, a):

app = QApplication([])

b = B()
p = Printer()

correctly works with my patch applied. It does not if you let A
inherit from object.

I thought that this is because QObject has a special metaclass
which does something to the signals, but replacing the definition
of A with class A(object, metaclass=QObject.__class__)
interestingly did not help.

Btw, why is it called pyqtSignal and not just signal, for those
in need for details they could just write QtCore.signal


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140213/c615c770/attachment.html>

More information about the PyQt mailing list