Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-82295

Inconsistent handling of enums and flags in the Qt namespace

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.14.0
    • Core: Object Model
    • 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 

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            mbrasser Michael Brasser
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes