Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
6.7.0
-
None
-
macOS 14.3.1
Python 3.10.13 from brew
pip install PySide6==6.7.0
Description
Here is a small repro:
import sys from PySide6 import QtWidgets class TestWidget(QtWidgets.QWidget): def __init__(self, parent=None): super().__init__(parent) self.showMaximized() def event(self, event): # custom event processing with fall-back return super().event(event) def showEvent(self, event): # custom showEvent processing with fall-back super().showEvent(event) if __name__ == "__main__": app = QtWidgets.QApplication([]) widget = TestWidget() widget.show() sys.exit(app.exec())
This code runs fine with PySide6<=6.6.3.1
With Pyside6==6.7.0, it raises the following TypeError:
Traceback (most recent call last): File "/Users/jbnoel/devel/avdiff/avdiff/test.py", line 23, in <module> widget = TestWidget() File "/Users/jbnoel/devel/avdiff/avdiff/test.py", line 10, in __init__ self.showMaximized() File "/Users/jbnoel/devel/avdiff/avdiff/test.py", line 14, in event return super().event(event) File "/Users/jbnoel/devel/avdiff/avdiff/test.py", line 18, in showEvent super().showEvent(event) TypeError: 'PySide6.QtWidgets.QWidget.showEvent' called with wrong argument types: PySide6.QtWidgets.QWidget.showEvent(QEvent) Supported signatures: PySide6.QtWidgets.QWidget.showEvent(PySide6.QtGui.QShowEvent)
3 workarounds to make the above code work:
- remove custom def event(self, event):
- remove custom def showEvent(self, event):
- "Convert" the event with the following workaround:
if event.type() == QtCore.QEvent.Show: event = QtGui.QShowEvent()
Attachments
Issue Links
- duplicates
-
PYSIDE-2675 Reg 6.6->6.7: Unable to get the QFileOpenEvent from a QEvent
- Closed