Details
-
Bug
-
Resolution: Out of scope
-
P4: Low
-
None
-
6.5.0
-
None
Description
Using the Slot() decorator on a method with type hints breaks type checking support.
Minimal example:
from PySide6.QtCore import QObject, Slot class A(QObject): # @Slot(str) def foo(self, text: str) -> None: print(text.lower()) a = A() a.foo(123)
Without Slot decorator, type mismatches are correctly reported:
With Slot decorator, no type mismatches can be found:
For the minimal example it works if I just annotate the Slot class like this:
Of course, that just passes along the signature of the decorated method.
It will not check if the type of the slot also matches. That might not be possible without a custom plugin. But i guess it's better to report some errors than nothing at all.