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