Important: Please read the Qt Code of Conduct -

A few questions/issues related to Qt Declarative in Qt 4.7.0

    1. According to documentation qmlRegisterType<T>() should be a "related non-member of QDeclarativeEngine", but including that library only results in "'qmlRegisterType' was not declared in this scope" error. Seems that QDeclarativeComponent must be included instead?

    2. If QDeclarativeComponent or QDeclarativeItem is included (with #include ..") in a subclass of QDeclarativeView on Windows it results in errors about "int qmlRegisterInterface(const char*)" in qdeclarative.h and will not compile at all. Is this related to naming pollution still? Wasn't that supposed to be fixed already in 4.7.0 ?

    3. qmlRegisterType cannot be used in a subclasses of QDeclarativeView (propably because of the reason 2 above)?

  • This might all be due to a bug in Qt itself. No compile errors is generated if the #include <QDeclarativeItem> is defined before #include <QGLFormat> (in an example were I encountered this problem). This was pointed out by Kim Grönholm form QUIt Coding. He also reported this as a bug. But still I wonder why qmlRegisterType does not derive from QDeclarativeEngine...

  • thanks johannes, I was trying to run the 5inarow game, your post was helpful :)

  • Kim informed me that the include order issue above has been addressed and is fixed in Qt 4.7.1

Log in to reply