Hi.
Just out of curiosity.
I have several C++ plugins, which I successfully export to QML 
using QDeclarativeExtensionPlugin. Within the plugin class
I do:
void registerTypes(const char *uri){
   qmlRegisterType<MyClass>(uri, 1, 0, "myclass");
}

My classes inherits QAbstractListModel and I can just use them in QML
without any import statement.

Yesterday I a hell of a ride to export an enum, which I wrapped into 
a class, to QML. I did exactly the same, but as I did with my model 
plugins, but it never worked. I thought I did something wrong with
Q_ENUMS. But more or less by coincidence I found, that I could not use
the above function to register my enum class, but hat to write:

void registerTypes(const char *uri){
   Q_UNUSED(uri)
   qmlRegisterType<MyClass>("myENUMS", 1, 0, "myclass");
}

And then do:
import myENUMS 1.0 in the qml file.

Is there a good explanation for this difference in behaviour? Is it 
somewhere documented? Feels rather inconsitent to me.

Btw. later on I changed qmlRegisterType to qmlRegisterUncreatableType,
but this had no effect on my inital problem.

Guido
_______________________________________________
Qt-qml mailing list
Qt-qml@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to