Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-23265

QML code completion ignores strongly typed enum scope

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • Qt Creator 4.10.2
    • Quick / QML Support
    • None
    • Linux/X11

      I'm exposing a strongly typed enum through C++ to QML like so:

      class AppSettings : public QObject
      {
           Q_OBJECT
           Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")

      public:

           enum class SettingKeys {
               FastRender
           };
           Q_ENUM(SettingKeys)

      ...

      }

      AppSettings is registered as:

      qmlRegisterType<AppSettings>("myextension", 1, 0, "AppSettings");

      In the QML editor if ctrl+space is pressed after "AppSettings." a list of all available enums in the class is shown without their enclosing scope.

      Since the class is declared with "RegisterEnumClassesUnscoped" the code that the QML editor suggest will be incorrect (since the scope is needed).

      The code will thereafter fail silently which is a bit troublesome to debug since the editor is suggesting the incorrect path to the enum value.

      Expected behavior:
      Code completion completes to: "AppSettings.SettingKeys.FastRender".

      Current behavior:
      Code completion completes to: "AppSettings.FastRender".

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

            Unassigned Unassigned
            tobias_m Tobias Marciszko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes