Details
-
Suggestion
-
Resolution: Unresolved
-
P4: Low
-
None
-
None
-
None
Description
If you attempt to type check the following code:
from PySide6.QtCore import Qt x = Qt.KeyboardModifier.KeypadModifier | Qt.Key.Key_0
you'll get the following error:
x.py:42: error: Unsupported operand types for | ("KeyboardModifier" and "Key") [operator] x = Qt.KeyboardModifier.KeypadModifier | Qt.Key.Key_0 ^~~~~~~~~~~~ Found 1 error in 1 file (checked 1 source file)
I propose adding the following to QtCore.pyi (but I'm not sure how to submit a PR here )
class _SupportsOrKey(enum.Flag): @overload def __or__(self, other: Self) -> Qt.KeyboardModifier: ... @overload def __or__(self, other: Qt.Key) -> QKeyCombination: ... @overload def __ror__(self, other: Self) -> Qt.KeyboardModifier: ... @overload def __ror__(self, other: Qt.Key) -> QKeyCombination: ... class Qt(Shiboken.Object): class KeyboardModifier(_SupportsOrKey): ... class Modifier(_SupportsOrKey): ...