TypeError: unsupported operand type(s) for &: 'int' and 'KeyboardModifier' for PySide6
- Dominant language
- C
- Stars
- 97
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
We are using `enable` together with `chaco` and `traits` in `PySide6` application with Python 3.10. On both macOS and Windows, stderr gets flooded with `TypeError` from `BaseWindow._create_mouse_event()`:
```
Traceback (most recent call last):
File "enable\qt4\base_window.py", line 270, in leaveEvent
File "enable\qt4\base_window.py", line 148, in leaveEvent
File "enable\abstract_window.py", line 349, in _handle_mouse_event
File "enable\qt4\base_window.py", line 515, in _create_mouse_event
TypeError: unsupported operand type(s) for &: 'int' and 'KeyboardModifier'
```
The respective code reads `alt_down=bool(modifiers & QtCore.Qt.AltModifier),` and it seems that the problem is that many enums from the current `PySide6` implementation do not automatically convert to `int`.
It could be sufficient to use `.value()` to get the `int` value just like this:
```
alt_down=bool(modifiers & QtCore.Qt.AltModifier.value),
```
These are the versions we use:
- PySide6==6.4.0
- enable==5.3.1
- Python 3.10.8
Contributor guide
Assessment
This issue has not been assessed yet.