[PySide] SOLVED: Correction: TypeError setting multiple inheritance instance as QWidget parent

Owen Kelly owensother at sympatico.ca
Wed Oct 10 20:40:08 CEST 2012


Hi all,

I think I have found the solution. My model code did *not* raise an error,
but my actual code did. I haven't fixed it yet, but I just discovered that
in my actual code

	Foo is subclassed from Pyside.QtGui.QTabWidget

	Bar is subclassed from PyQt4.QtGui.QDialog

Given that the model code works, the problem is almost certainly that
PyQt4.QtGui.QDialog.__init__ will not accept a parent of type
Pyside.QWidget.  No surprise!

The moral of the story is not to mix PySide and PyQt.

Thanks Aaron.

Regards,

Owen 


-----Original Message-----
From: pyside-bounces+oekelly=ieee.org at qt-project.org
[mailto:pyside-bounces+oekelly=ieee.org at qt-project.org] On Behalf Of Aaron
Richiger
Sent: October-10-12 2:22 PM
To: pyside at qt-project.org
Subject: Re: [PySide] Correction: TypeError setting multiple inheritance
instance as QWidget parent

Hello Owen!

The following code works great on my machine... It is basically your code
with a main block to test it. Please try to execute it and if it is
successful, try to find the difference with your non-working version. I
guess, the difference will be in the main block?!?

Have a nice evening!
Aaron

########### Code ############

import sys
from PySide import QtGui


class Node(object):
     pass


class Foo(QtGui.QTabWidget, Node):

     def __init__(self):
         super(Foo, self).__init__(parent=None)
         Node.__init__(self, 'Node name is Disp')
         self.bar = Bar(self)


class Bar(QtGui.QDialog):

     def __init__(self, parent_widget):
         super(Bar, self).__init__(parent=parent_widget)


if __name__ == "__main__":
     app = QtGui.QApplication(sys.argv)
     w = Foo()
     w.show()
     sys.exit(app.exec_())
_______________________________________________
PySide mailing list
PySide at qt-project.org
http://lists.qt-project.org/mailman/listinfo/pyside




More information about the PySide mailing list