-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
6.4.2
-
None
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.
- relates to
-
PYSIDE-1675 Improve mypy compatibility with our python stubs (pyi)
-
- Open
-
For Gerrit Dashboard: PYSIDE-2235 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
493792,3 | stubs: setParent should accept an Optional object | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
494012,2 | stubs: setParent should accept an Optional object | 6.5 | pyside/pyside-setup | Status: MERGED | +2 | 0 |