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

Simon Hausmann Simon.Hausmann at qt.io
Tue Jul 26 16:54:46 CEST 2016


Hi,


By the time this aspect of the QML engine was implemented, C++11 scoped enums did not exist. I think it would be fine

to add this feature to the JavaScript bindings for C++ classes.


Simon

________________________________
From: Development <development-bounces+simon.hausmann=qt.io at qt-project.org> on behalf of BogDan Vatra <bogdan at kdab.com>
Sent: Tuesday, July 26, 2016 4:50:38 PM
To: development at qt-project.org
Subject: [Development] QML: Why C++11 scoped enums are not scoped in QML ?

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.
_______________________________________________
Development mailing list
Development at qt-project.org
http://lists.qt-project.org/mailman/listinfo/development
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160726/404c6eea/attachment.html>


More information about the Development mailing list