Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.7.0
-
None
Description
Consider the following class definition:
#include <QObject> enum class FOO { BAR }; class Exported: public QObject { Q_OBJECT public: using QObject::QObject; using FOO = ::FOO; Q_ENUM(FOO) };
Exported to the QML environment as it follows:
qmlRegisterType<Exported>("Package", 1, 0, "Exported");
We can't use the named constant as usual, that is:
import Package 1.0 // ... Exported.BAR
On the other side, the following works fine:
class Exported: public QObject { Q_OBJECT public: using QObject::QObject; enum class FOO { BAR }; Q_ENUM(FOO) };
As weel as this one:
class Exported: public QObject { Q_OBJECT public: using QObject::QObject; enum class FOO; Q_ENUM(FOO) enum class FOO { BAR }; };
In other terms using declarations, even though they import a set of names into their declarative regions, are not treated as enum declarations.
Documentations is misleading. If the issue can't be solved, the docs should be updated at least.
—
Here is a question on SO related to the argument: http://stackoverflow.com/questions/40511980/q-enums-and-using-declarations-do-not-work-together