Details
-
Bug
-
Resolution: Duplicate
-
P4: Low
-
None
-
6.5.3
-
None
Description
The following code example shows that the return type of QLayout.itemAtPostion must be `QLayoutItem | None`:
from typing import TYPE_CHECKING from PySide6.QtWidgets import QGridLayout layout = QGridLayout() item = layout.itemAtPosition(0, 0) print(f"Got {item}") if TYPE_CHECKING: reveal_type(item)
When I run the code:
Got None
When I run mypy:
note: Revealed type is "PySide6.QtWidgets.QLayoutItem“
Attachments
Issue Links
- duplicates
-
PYSIDE-2440 Type hints should indicate optionality
- Closed