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

Non-local enums inside Q_PROPERTY should be accepted by QML

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P2: Important
    • 5.3.0
    • 5.0.0, 5.1.1
    • Build tools: moc
    • None
    • 54f0733e7df4134afbcf0a81ba39751f31c9b84d

    Description

      Currently QML only supports non local enums as Q_PROPERTY if they are declared in the same class or if they are re-declared with Q_ENUMS. For example:

      struct EnumHolder : public QObject { 
          enum Enum { Value1, ... };
      };
      
      struct Foo : public QObject {
          Q_ENUMS(EnumHolder::Enum); // this should not be needed!
          Q_PROPERTY(EnumHolder::Enum property READ property WRITE setPproperty NOTIFY ...)
      ...
      };
      
      Item {
          Foo { property: EnumHolder.Value1 }
      }
      

      Without Q_ENUMS(EnumHolder::Enum); assignment in QML would not work (reading is ok)

      Attachments

        Issue Links

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

          Activity

            People

              shausman Simon Hausmann
              nierob Nierob
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes