P
P
Pavel Matveev2022-02-18 14:59:29
Qt
Pavel Matveev, 2022-02-18 14:59:29

Qt, when registering a C++ QML element, substitutes the wrong C++ class path into the assembly. What to do?

Hello!
I'm trying to register a C++ class as a QML component by adding a QML_ELEMENT macro to it in the description.
The .h and .cpp class files are in a different folder from main.cpp. And MOC, during the build of the project, substitutes the path to the C ++ class file, as if it were next to main.cpp. Ie:
Registering the class
620f88f085a21608549237.png

Location of the class files and main.cpp
620f89410a3ac007984916.png

Error that the assembler writes:
620f899d87d14503034152.png

The place where the error occurs, and what path the assembler substitutes:
620f89eda322b114143592.png

I.e. the collector simply substitutes the wrong path to the C++ class. What can be done with this, besides just manually editing the file path and moving the file to the same folder as main.cpp ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question