Actually, everything you need to do it, is more or less in my first post.
In your C++ file you 'mark' your enum with Q_ENUMS, e.g. Q_ENUMS(<myEnum>).
The class has to be a QObject, or include Q_GADGET.

Somewhere you then have to register your enum:
qmlRegisterUncreatableType<class_where_your_enum_is_defined>("<myEnum>", 1,
0,"<arbitrary name>", "");

That's all in the C++ part.

In QML:
import <myEnum> 1.0

and then if your enum is:
enum bla{
     Foo1
   , Foo2
   , Foo3
}

You can use it like:

 <arbitrary name>.Foo1
 <arbitrary name>.Foo2

Enum names must start with an uppercase letter.

Guido


> Hi,
>
> I've been looking for something like this, can you give me a more
> concrete example? I'm not sure I understand how you were able to do
> it.
>
> Tim.
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to