[Qt-qml] enumerations in QML

Alex alexlordax+qt at gmail.com
Thu Aug 5 02:36:29 CEST 2010


[ Sorry, I'll stop flooding the mailing list in a minute :-)  ]

Is there any way to declare enumerations in QML?  For example, assume I
have a custom element called "MyText" that has a property called
sizeType, for which the possible values are: "small", "medium", or
"big."

The implementation of MyText will set the correct point or pixel size
based on the value of sizeType.  Is there a way to expose the possible
values using an enum (e.g., MyText::SizeBig) rather than something
more primitive like int or string?

Similarly, what is the best way to declare constants?

Thanks,
Alex



More information about the Qt-qml mailing list