Details
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
- relates to
-
PYSIDE-2304 Class inheritance order breaks initialisation order
- Closed
-
PYSIDE-2354 Type error for multiple inheritance using typing.Generic
- Reported
- resulted from
-
PYSIDE-1564 QObject does not support cooperative multiple inheritance
- Closed