Details
-
Suggestion
-
Resolution: Fixed
-
P3: Somewhat important
-
None
-
None
-
c01cab8dd (dev), b00c1662d (6.7), 7b7bd14c7 (tqtc/lts-6.5)
Description
When using the `Property` decorator in PySide6, for example:
@QmlElement class SomeObject(QObject): def __init__(self): super().__init__() self._name: str = "ObjectName" @Property(str) def name(self) -> str: return self._name
Multiple type checkers fail with the error:
error: "Property" not callable [operator]
This seems to be caused by the Property definition in `QtCore.pyi`, though I'm struggling to see exactly why.
QtCore.pyi: class Property(object): def __init__(self, type: type, fget: Optional[Callable] = ..., fset: Optional[Callable] = ..., freset: Optional[Callable] = ..., fdel: Optional[Callable] = ..., doc: str = ..., notify: Optional[Callable] = ..., designable: bool = ..., scriptable: bool = ..., stored: bool = ..., user: bool = ..., constant: bool = ..., final: bool = ...) -> None: ... def deleter(self, fdel: Callable) -> PySide6.QtCore.Property: ... def getter(self, fget: Callable) -> PySide6.QtCore.Property: ... def read(self, fget: Callable) -> PySide6.QtCore.Property: ... def setter(self, fset: Callable) -> PySide6.QtCore.Property: ... def write(self, fset: Callable) -> PySide6.QtCore.Property: ...
Attachments
Issue Links
- relates to
-
PYSIDE-2541 Fix type inference for QmlElement
- Reported