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

Non-local enums should be accepted as QML signal and method parameters

    XMLWordPrintable

Details

    • 37cd29b2ff024f27f84ef6214ff5403603d522f2

    Description

      Currently QML only supports enums as signal and method parameters if they are declared in the same class as the signal or method. This is a limitation inherited from QMetaObject, that doesn't allow QML to determine if the parameter type is an enum, or just some other random type.

      The ideal solution would be to extend Q_ENUMS() to support "registering" an enum from another class. For example:

      class Foo : public QObject {
          Q_ENUMS(Bar::CustomEnum);
      
      slots:
          void myMethod(Bar::CustomEnum);
      };
      

      in this case, all QML really needs is for the Bar::staticMetaObject to appear in the Foo::staticMetaObject's extra data list.

      Attachments

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

        Activity

          People

            glwatson Glenn Watson
            aakenned Aaron Kennedy
            Votes:
            9 Vote for this issue
            Watchers:
            15 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes