Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.14.0
-
None
Description
There is wide variation in how enums and flags are handled in the Qt namespace. For example:
- QT_Q_FLAG(SplitBehavior): this seems to follow
QTBUG-77216(Q_FLAG on the enum itself) - QT_Q_FLAG(MouseButtons): this uses the macro on the flags rather than the enum itself
- QT_Q_ENUM(WindowState) and QT_Q_FLAG(WindowStates): this uses the macro on both, which is somewhat unclear given the advice of Q_FLAG documentation ("The Q_FLAG macro takes care of registering individual flag values with the meta-object system, so it is unnecessary to use Q_ENUM() in addition to this macro.")
The end result is inconsistency in using these with the metatype/metaobject system. For example:
qMetaTypeId<Qt::MouseButtons>() // okay qMetaTypeId<Qt::MouseButton>() // not okay