Details
-
Suggestion
-
Resolution: Won't Do
-
P4: Low
-
None
-
6.5.3, 6.6.1
-
None
-
Python 3.11.6
Windows 10 Version 10.0.19045 Build 19045
Description
As title says: QtCore.QSettings.value should infer return type from type parameter by adding a top overload with a TypeVar
The overload would look something like this:
_T = TypeVar("_T") # typing.TypeVar, not ast.TypeVar class QSettings(PySide6.QtCore.QObject): ... @overload def value(self, arg__1: str, defaultValue: _T, type: type[_T]) -> _T: ...
So that casting isn't needed when using:
value = cast( bool, QtCore .QSettings("AutoSplit", "Check For Updates On Open") .value("check_for_updates_on_open", True, type=bool), )
Attachments
Issue Links
- relates to
-
PYSIDE-2541 Fix type inference for QmlElement
- Reported