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

Q_ENUMS from one class cannot be used as a Q_INVOKABLE function parameter of another class

    XMLWordPrintable

Details

    Description

      When declaring in the same class one enumeration, the corresponding Q_ENUMS, and a Q_INVOKABLE function with the enumeration in parameter, the function can be called from qml.
      But if the enumeration comes from another class, the Q_INVOKABLE function cannot be called with the following error message:
      "Error: Unknown method parameter type"

      I read in the following page:
      http://doc.qt.nokia.com/4.7-snapshot/qtbinding.html#using-enumeration-values-as-signal-parameters
      this requirement:
      "C++ signals may pass enumeration values as signal parameters to QML, providing that the enumeration and the signal are declared within the same class, or that the enumeration value is one of those declared in the Qt Namespace."

      I guess the same requirement applies for Q_INVOKABLE functions ? Can you document it as well ?
      Is there a way to bypass this requirement ? I would like to share some enumerations in many classes.

      Attachments

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

        Activity

          People

            aakenned Aaron Kennedy
            agroyer Anthony Groyer
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes