[Development] QML: Why C++11 scoped enums are not scoped in QML ?

BogDan Vatra bogdan at kdab.com
Tue Jul 26 16:50:38 CEST 2016


Hi,

Is there any reason why C++11 scoped enums are not scoped in QML ?
If I have something like the following code in C++

class MyClass : public QObject
{
 Q_OBJECT
public:
 enum class MyEnum : uint16_t {
   Val1,
   Val2,
 }
 Q_ENUM(MyEnum)
);

// register the class 

I'd like to use it in QML as:
console.log(MyClass.MyEnum.Val1)
not as 
console.log(MyClass.Val1)

Cheers,
BogDan.



More information about the Development mailing list