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

Make better error message for Q_ENUM with lower-case value names

    XMLWordPrintable

Details

    Description

      I created a Q_GADGET class with an enum inside and registered it with QML, but I formatted the enumeration value names as lowerCamelCase instead of UpperCamelCase. Everything worked as anticipated, except that any reference to `GadgetName.enumValue` in QML (which Qt Creator did correctly autocomplete!) would resolve as undefined.

      I spent several hours trying to figure out what I'd done wrong before finally stumbling upon a StackOverflow page which mentioned that the value names had to start with an upper-case letter.

      Some warning about this (possibly from moc?) would have been nice, as it would have saved me several hours and substantial aggravation. At the very least, this caveat should be mentioned at https://doc.qt.io/qt-5/qobject.html#Q_ENUM

      Attachments

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              nh Nathan Hourt
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes