Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
5.15.8, 6.2.4, 6.3.0 Beta2
-
None
-
8
-
Team Two Foundation Sprint 50, Team Two Foundation Sprint 51, Team Two Foundation Sprint 52, Team B Foundation Sprint 53, Team B Foundation Sprint 55, Team B Foundation Sprint 56, Team B Foundation Sprint 57, Team B Foundation Sprint 58, Team B Foundation Sprint 59
Description
In C++, mixed enum-enum-arithmetic is deprecated since C++20. Unfortunately, we use it all over the place in Qt. Most of those cases relate to combining various flags. To future proof Qt, we need to address those.
Currently, those are (if fixed at all) handled in a rather ad-hoc way. The most prominent example would be QKeyCombination, introducing a new class with a somewhat rich API (key/keyboardModifiers/toCombined). In most other places, explicit casts to int are used.
While a custom class might be warranted for public API, for internal flag handling this seems to be overkill. However, sprinkling casts or bespoke operator| all over the place is also not ideal. Thus, the idea is to create a new template, QFlagsV2 (name pending), which would have an API similar to QFlags, but supporting 2 or more different enums.
Attachments
Issue Links
- replaces
-
QTBUG-94059 Stop using mixed enum arithmetic
- Closed
- resulted in
-
QTBUG-101306 enum-enum warning in qxcbwindow.cpp is genuiune
- Closed
For Gerrit Dashboard: QTBUG-99948 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
398113,7 | Restore C++20-deprecated mixed-enum bitwise operators | dev | qt/qtbase | Status: MERGED | +2 | 0 |
400599,2 | Restore C++20-deprecated mixed-enum bitwise operators | 6.3 | qt/qtbase | Status: MERGED | +2 | 0 |
400600,3 | Restore C++20-deprecated mixed-enum bitwise operators | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 |
400611,5 | Restore C++20-deprecated mixed-enum bitwise operators | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |
401380,3 | PySide6: Fix build broken by mixed flag operators | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
401389,5 | shiboken6: Fix comparison operators in namespaces | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
401903,2 | shiboken6: Fix comparison operators in namespaces | 6.2 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
410681,2 | GLSL parser: fix build with C++20 -Wdeprecated-enum-enum-conversion | dev | qt/qtquick3d | Status: MERGED | +2 | 0 |
410948,2 | GLSL parser: fix build with C++20 -Wdeprecated-enum-enum-conversion | 6.3 | qt/qtquick3d | Status: MERGED | +2 | 0 |