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

Non-local enums inside Q_PROPERTY should be accepted by QML

XMLWordPrintable

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

      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)

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes