Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
6.4.2
-
None
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