[Development] QML: Why C++11 scoped enums are not scoped in QML?
BogDan Vatra
bogdan at kdab.com
Wed Jul 27 09:53:29 CEST 2016
On marți, 26 iulie 2016 20:08:52 EEST Olivier Goffart wrote:
> On Dienstag, 26. Juli 2016 08:33:31 CEST Thiago Macieira wrote:
> > Em terça-feira, 26 de julho de 2016, às 17:50:38 PDT, BogDan Vatra
escreveu:
> > > Hi,
> > >
> > > Is there any reason why C++11 scoped enums are not scoped in QML ?
> >
> > There's no trait to tell apart a scoped enum from an unscoped one. An enum
> > is en enum, that's all.
> >
> > If you want a given enum to be scoped in QML, it should be a QML engine
> > feature and should be available to any C++ enum, whether it's scoped or
> > not.>
> > > If I have something like the following code in C++
> >
> > [cut]
> >
> > > Q_ENUM(MyEnum)
> >
> > This is all the engine sees. It's an enum.
>
> It's trivial to let QMetaEnum know about scoped enum:
>
> https://codereview.qt-project.org/166136/
>
What timing ! :) Thanks Olivier!
>
> That said, it would be a behavior change not to allow anymore the previous
> (unscoped) syntax to work with QML
The unscoped enums should work as they are woring now, just the scoped ones
should be scoped in QML as well.
Based on your patch, I'll try to prepare a patch for QML.
Cheers,
BogDan.
More information about the Development
mailing list