[PySide] TypeError setting multiple inheritance instance as QWidget parent

Owen Kelly owensother at sympatico.ca
Wed Oct 10 19:07:53 CEST 2012

Hello all,


I am migrating from PyQt to PySide; the PyQt code works.

I am trying to resolve a multiple inheritance issue.


The problem seems to be that PySide.QDialog.__init__ does not recognize an
instance of Foo as a possible parent.


unhandled TypeError

QDialog(QWidget parent=None,Qt.WindowFlags flags=0): argument 'parent' has
unexpected type 'Foo'


However, Foo is subclassed from QWidget but also from another class, Node.

Simplified code:


import sip

sip.setapi('QString', 2)

sip.setapi('QUrl', 2)


from PySide import QtGui


class Node(object):



class Foo(QtGui.QTabWidget, Node): 

  def __init__(self):

    self.bar = Bar(self) # Can I fix this by giving a different argument to


class Bar(QtGui.QDialog):

    def __init__(self, parent_widget):

        super(Bar, self).__init__(parent=parent_widget) # <<<<<<<<==========
TypeError occurs here

        #QtGui.QDialog.__init__(self, parent=parent_widget)  # using this
line instead of line above gives same error


Is the solution here that I should use composition instead of inheritance?

A related question may be this


Python 2.6.6, Win32, PySide 1.1.1


If multiple inheritance is not possible, maybe 


could be updated.


Thanks for your suggestions.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20121010/9847ba7c/attachment.html>

More information about the PySide mailing list