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

Non-local enums undefined in QML

XMLWordPrintable

      This issue occurs if you derive an existing class (e.g. QSettings) which doesn't register their enums via Q_ENUMS or Q_ENUM.

      You can make the enum keys visible in QML (autocomplete) if the child class registers them with Q_ENUMS, but it seems that QML can't resolve the related values.

      Surprisingly you can get the enum values from Q_INVOKABLE methods, slots and signals if you register the parent enum via Q_DECLARE_METATYPE and qRegisterMetaType (see QTBUG-20639).

      For Qt classes the problem could be solved, if QTBUG-28586 gets fixed.

      But shouldn't there be a general solution if you can't change the parent class?

      (Associated commits here and here).

        1. main.cpp
          0.5 kB
        2. main.qml
          0.7 kB
        3. settings.cpp
          0.0 kB
        4. settings.h
          0.6 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Unassigned Unassigned
            WhatABug Andy Sittig
            Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes