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

Enum type is returned as object instead of number

XMLWordPrintable

    • Linux/X11
    • ae9be1a63d7b579fb5bb8b4bf903f1a3efe7168f

      The return value should return an enum value which can be used to compare it to the exposed enum constants.

      But the return values are treated as objects and can not be compared to the integer constants:

      // in C++
      enum StatusCode { Good };
      QtBugNamespace::StatusCode goodStatus() // returns an enum
      
      // in QML
      // QtBugImport.Constants.Good == 0 (number)
      // but object.goodStatus is "Good" (object)
      
      

      This happens for QObject as well as Q_GADGET. Change https://codereview.qt-project.org/244514 was already applied on top of 5.12

      When moving the namespace from ns.h into foo.h it suddenly works.

      The example contains a QObject and a Q_GADGET with the same issue.

        1. QTBUG-71966.tar.gz
          1 kB
          Rainer Keller
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            ulherman Ulf Hermann
            rakeller Rainer Keller
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes