Problem in registering Cpp code in Qml in QtSDK 1.1.3update



  • hi,

    i was developing Qt-Quick apps under QtSDK 1.1.3
    and the register Cpp code for Qml was pretty easy
    by putting
    @qmlRegisterType<CppCode>("CppCode", 1, 0, "CppCode");@
    in main.cpp
    and then
    @import CppCode 1.0@
    in the desired Qml file then use it by
    @onSlot: .....@

    that was working well

    but after updating QtSDK1.1.3 to 29Sep update

    the above technique was generating errors

    @main.cpp: In function 'int main(int, char**)':
    main.cpp:10: error: 'qmlRegisterType' was not declared in this scope
    main.cpp:10: error: expected primary-expression before '>' token
    main.cpp:10: warning: left-hand operand of comma has no effect
    main.cpp:10: warning: right-hand operand of comma has no effect
    main.cpp:10: warning: right-hand operand of comma has no effect@

    any suggestions



  • You are probably missing an #include.
    Try #include <qdeclarative.h>, that has the declaration of qmlRegisterType.



  • it works
    thx tmcguire


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.