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. Incompatibility Between QT Design Studio and Incorporating C++?
Forum Updated to NodeBB v4.3 + New Features

Incompatibility Between QT Design Studio and Incorporating C++?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 186 Views
  • 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.
  • G Offline
    G Offline
    ggalt
    wrote on last edited by
    #1

    I'm rather rusty with QML and C++, so I've been reading some of the documentation. I'm trying to understand the reason behind this note "Note: Uncheck the With ui.qml file option in the Define Project Details section of New Project Wizard." in the document "Integrating QML and C++".

    I've been experimenting with using QML_ELEMENT with a C++ class so that I can use it in my QML files (not necessarily the ui files). However if I create the class and initialize it in main.cpp (and insert a qt_add_qml_module statement with the class files under "SOURCES" in my CMakeLIsts.txt file), I get an error thrown in a generated file saying that it cannot find the class header file:

    C:/Users/georg/workspace/build-test3-Desktop_Qt_6_6_1_MinGW_64_bit-Debug/test3app_qmltyperegistrations.cpp:10:10: fatal error: testqmlelement.h: No such file or directory
       10 | #include <testqmlelement.h>
          |          ^~~~~~~~~~~~~~~~~~
    compilation terminated.
    

    So it seems that the "note" is correct. However, I'm at a loss as to why this is.
    Why can't one use a Qt Design Studio project with C++ code? Or am I missing something.

    FYI, I've watch the excellent series on Youtube regarding QML programming and in particular, the video on registering a C++ class with QML, but it doesn't address this issues.

    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