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

Problem with enum class from namespace used as QObject property

    XMLWordPrintable

Details

    • Windows

    Description

      It seems that the enum class property works differently if the enum type was instatied in namespace or in QObject.

       

      I haved created two analogous enums and the comparison in QML don't work if i use enum class that was declarated in namespace (with Q_NAMESPACE and Q_ENUM_NS) (see the attached application).

       

      Additionally, if I remove Q_DECLARE_METATYPE(model::UserType) from ModelEnums.h i get the error: QMetaProperty::read: Unable to handle unregistered datatype 'model::UserType' for property 'User::userType' but in the documentation of Q_ENUM_NS i can read: 

      "Registered enumerations are automatically registered also to the Qt meta type system, making them known to QMetaType without the need to use Q_DECLARE_METATYPE()."

       

      Attachments

        Issue Links

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

          Activity

            People

              ulherman Ulf Hermann
              permotion88 Karol Polak
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes