Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
None
-
5.15.2
-
None
Description
https://doc.qt.io/qt-5/qevent.html#Type-enum
https://doc.qt.io/qt-5/qevent.html#registerEventType
import PyQt5.QtCore reveal_type(PyQt5.QtCore.QEvent.registerEventType) reveal_type(PyQt5.QtCore.QEvent.Type.__int__) import PySide2.QtCore reveal_type(PySide2.QtCore.QEvent.registerEventType) reveal_type(PySide2.QtCore.QEvent.Type.__int__)
Running mypy on the above code results in this output.
y.py:2: note: Revealed type is 'def (hint: builtins.int =) -> builtins.int' y.py:3: note: Revealed type is 'def (builtins.int) -> builtins.int' y.py:6: note: Revealed type is 'def (hint: builtins.int =) -> builtins.int' y.py:7: error: "Type[Type]" has no attribute "__int__" y.py:7: note: Revealed type is 'Any'
Since QEvent.Type doesn't have, according to the hints, an ._int_() method we can't even explicitly convert. If nothing else, shouldn't we be able to int() an enumerator?