Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Problem in registering Cpp code in Qml in QtSDK 1.1.3update
Qt 6.11 is out! See what's new in the release blog

Problem in registering Cpp code in Qml in QtSDK 1.1.3update

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 3.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MamdouhAlShamy
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tmcguire
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MamdouhAlShamy
        wrote on last edited by
        #3

        it works
        thx tmcguire

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved