[Qt-qml] enumerations in QML
Jan Ekholm
jan.ekholm at smultron.net
Thu Aug 5 09:16:55 CEST 2010
On Thursday 05 August 2010 08:03:41 bea.lam at nokia.com wrote:
> On 05/08/2010, at 2:45 PM, ext Gregory Schlomoff wrote:
> > Isn't there a way to expose an enum to QML with qRegisterType or
> > something?
>
> If an enum is exposed to Qt's Meta Object system using Q_ENUMS, the enum is
> automatically available to QML.
>
> This is mentioned in
> http://doc.qt.nokia.com/4.7-snapshot/declarative-tutorials-extending-chapt
> er4-custompropertytypes.html (but probably should be moved to some other
> reference documentation).
I did my C++ enum just like that and it did not work at all. After some
fighting and testing all combinations of foo.bar that I could think of on the
QML side I have up an rewrote it to not need the enum on the QML side. There's
a chapter "Extending QML from C++" (or similar, my Assistant currently doesn't
seem to show any QML docs at all (bug report added)) where the information
from the tutorial would perhaps fit better?
--
Many an ancient lord's last words had been:
"You can't kill me because I've got magic aaargh...."
-- Terry Pratchett, Interesting Times
More information about the Qt-qml
mailing list