[Development] Enumerations in QML

Chris Adams chris.adams at qinetic.com.au
Wed Dec 12 08:19:11 CET 2012


I figured I weigh into this discussion:

> But if you don't like those changes, you can do the var in a global
> (.pragma library) script file and use that. Maybe this means proper
> enum support isn't that urgent ;) .

It's not that the functionality is urgent; it's that currently,
QML-document-defined-types are most definitely second-class citizens in
QML.  It would be very nice to unify the various type-definition processes
to be more equal, in my opinion.  Enum support is certainly one of these

However, unfortunately, there's another related area which precludes any
such extensions to QML document-defined types: typename support in
Currently, composite types are handled in a different manner to other
(C++-defined) types: they're not backed by a QQmlType, and the typenames
are not exposed to JavaScript.
Being able to define enums in QML documents is of minimal utility if the
typename itself is unavailable for use in JavaScript expressions.

It would certainly be very nice if the QML type system could be improved to
unify handling of different type definition sources (it'd also allow
Qt.createComponent(typename) to be implemented, finally), however the
amount of effort required to implement the type system changes is not

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20121212/1a24c82f/attachment.html>

More information about the Development mailing list