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

Allow exporting enums from C++ to QML without wraping them in a QObject

XMLWordPrintable

      Right now, the only possibility to use C++ enums in QML is to wrap them in a QObject and then export the entire QObject to QML.
      It would be much more convenient if exporting an enum directly would be possible.

      The desired workflow for that would be something like this:
      code
      enum Weather

      { Raining, Sunny, Cloudy }

      ;
      Q_DECLARE_METATYPE(Weather)
      qmlRegisterType<Weather>("Foo", 1, 0, "Weather");
      code

      Ideally, the enum should not only be supported as a function parameter or return value when invoking C++ code, but also as properties in QML, as QTBUG-15483 describes.

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

            qtqmlteam Qt Qml Team User
            tmcguire Thomas McGuire
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes