[Interest] C++ enums undefined in QML

Ola Røer Thorsen ola at silentwings.no
Fri Nov 15 09:51:11 CET 2013


Did you remember to import your registered type in your qml code? If you
register something like this,

qmlRegisterType<MyClass>("MyClass",1,0,"MyClass");

where you have your enums then in qml you need to import that type on the
top of your code,

import MyClass 1.0

Cheers,
Ola




2013/11/14 Guido Seifert <wargand at gmx.de>

> Hi,
> I have a little problem with my enums in QtQuick 2.
>
> Im a C++ class I created an enum and used Q_ENUMS to make the enums known
> to the property system.
> I registered my class with qmlRegisterType.
> So far so good. Works. I can invoke methods, which I marked with
> Q_INVOKABLE. Get signals from C++.
> Everythings works as expected. What I don't expect is that all my C++
> enums are 'undefined'.
> The QtCreator completion finds all enum names, so some of the export must
> have worked.
> However, I don't get any values.
>
> Any ideas?
>
> Guido
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131115/324f652f/attachment.html>


More information about the Interest mailing list