Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
6.4.2
-
None
-
-
6280d5060 (dev), 09b06281a (6.5)
Description
When setting a widget's parent to None, PyCharm's type checker complains that the type is invalid. This is however valid code but the stub files distributed with PySide6 are incorrect.
tab_widget.setParent(None)
The stubs do not allow the parent to be None.
@overload def setParent(self, parent: PySide6.QtWidgets.QWidget) -> None: ... @overload def setParent(self, parent: PySide6.QtWidgets.QWidget, f: PySide6.QtCore.Qt.WindowType) -> None: ...
The solution is to either make the type optional or add another overload.
I believe these stubs are generated somehow so I don't know how you would handle this.
PYSIDE-1675 is the ticket tracking issues like this I believe.
Attachments
Issue Links
- relates to
-
PYSIDE-1675 Improve mypy compatibility with our python stubs (pyi)
- Open
-
PYSIDE-2514 [Type Hints] Allow None as argument for QAbstractItemView.setModel and QGraphicsView.setScene
- Closed