Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
6.9.0, 6.9.1
-
None
-
da0f2625b (dev), d90b40c1b (6.9)
Description
In type hints, I find
@staticmethod def screenAt(point: PySide6.QtCore.QPoint, /) -> PySide6.QtGui.QScreen: ...
However, the C++ QGuiApplication.screenAt can return nullptr as well, and so the PySide implementation can return None: see attached code example, which outputs
<PySide6.QtGui.QScreen(0x178779c62f0, name="\\\\.\\DISPLAY1") at 0x000001787969AC80>
None
So the type hint should be
@staticmethod def screenAt(point: PySide6.QtCore.QPoint, /) -> PySide6.QtGui.QScreen | None: ...
Essentially the same thing is true for QGuiApplication.modalWindow.
Attachments
Issue Links
- relates to
-
PYSIDE-2440 Type hints should indicate optionality
-
- Closed
-
Gerrit Reviews
For Gerrit Dashboard: PYSIDE-3139 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
662553,1 | type hints: Fix some return types | dev | pyside/pyside-setup | Status: NEW | +1 | 0 |
662057,4 | type hints: Fix return types of QGuiApplication.screenAt and modalWindow | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
662205,2 | type hints: Fix return types of QGuiApplication.screenAt and modalWindow | 6.9 | pyside/pyside-setup | Status: MERGED | +2 | 0 |