Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2294

TypeError with PySide 6.5.0 for multiple inheritance of MainWindow

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.5.0, 6.6.0
    • 6.5.0
    • PySide
    • None
    • iOS/tvOS/watchOS, Linux/X11, Windows
    • e99951fc6 (dev), 52878af9d (6.5), 7b709cf59 (dev), a5a2e97aa (6.7), 706260d75 (6.6), aa36a32e3 (tqtc/lts-6.5)

    Description

      Hi,

      I have a python project that works fine with PySide6 6.4.3 and below. But it doesn't work after the upgrade to the recent one PySide6 6.5.0. The problem is with a constructor of MainWindow that is inherited from 2 classes (QMainWindow and UI-class created by Qt Designer).

      Here is the code to reproduce the problem:

      from PySide6.QtWidgets import QApplication, QMainWindow, QLabel
      
      class Ui_X_MainWindow(object):
          def setupUi(self, MainWindow):
              MainWindow.resize(400, 300)
              self.lbl = QLabel(self)
      
      class MainWindow(QMainWindow, Ui_X_MainWindow):
          def __init__(self):
              QMainWindow.__init__(self, parent=None)
              self.setupUi(self)
              self.lbl.setText("XXX")
      
      app = QApplication([])
      window = MainWindow()
      window.show()
      app.exec()
      

       

      Here is an error:

      window = MainWindow()
                   ^^^^^^^^^^^^^^^^^
      File "main.py", line 11, in _init_
        QMainWindow._init_(self, parent=None)
      TypeError: object._init_() takes exactly one argument (the instance to initialize)

       

      I think this code is based on Qt-examples as I have it in my project for 2-3 years already. But eventually it doesn't work anymore with PySide6 6.5.0 and I don't understand is it a bug or I need to change something.

      I've this problem confirmed on Windows but my users reported the same for Linux Ubuntu and MacOS. I see similar reports on stackoverflow.org for recent days.

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              ctismer Christian Tismer
              starterkit Ivan Ivanov
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: