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

QMetaType::typename() doesn't return the registered typedef for a QFlag

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 6.0, 6.2
    • Fix Version/s: None
    • Component/s: Core: Other
    • Labels:
      None

      Description

      Given a QObject derived class defining a QFlag like this:

      class TestObject : public QObject
      {
          Q_OBJECT
          enum TestFlag {
            Value1 = 0x1,
            Value2 = 0x2
          }
          Q_DECLARE_FLAG(TestFlags, TestFlag)
          Q_FLAG(TestFlags)
      }
      

      When trying to retrieve the typename using QMetaObject the value has changed from Qt 5.13 to Qt6:

      QMetaType::typeName(QMetaTypeId<TestObject::TestFlags>());
      

      With 5.13 this returns: TestObject::TestFlags
      Qt 6 returns: QFlags<TestObject::TestFlag>

        Attachments

          Issue Links

          For Gerrit Dashboard: QTBUG-83664
          # Subject Branch Project Status CR V

            Activity

              People

              Assignee:
              fabiankosmale Fabian Kosmale
              Reporter:
              gagi Dominik Holland
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There is 1 open Gerrit change