[Interest] problem with type registration during QML module compilation

Stefan Seefeld stefan at seefeld.name
Fri Jul 5 16:15:41 CEST 2024


Hello,

following up on an earlier conversation...

I'm trying to convert a legacy QML module to use the "new"
`qt_add_qml_module` function. This process includes the generation of a
..._qmltyperegistrations.cpp file that contains an invalid reference to a
header file <A.h>

My library layout looks like this:

libs/foo/
├── CMakeLists.txt
├── view
│   ├── A.h
│   ...
├── qml
...

and the makefile above compiles a shared library libfoo.so from the
contents. I now want to use `qt_add_qml_module()` to automate the
generation of the associated QML module (including all the QML resources,
as well as exposing the QML types defined in C++, such as the one in
`view/A.h`. However, the generated code expects to be able to include
"A.h", while it should actually be including "view/A.h". Is there a
property I should be passing to `qt_add_qml_module()` to make that happen,
or is there anything else I'm missing ?

For context: The type `A` is actually a singleton (a QQmlPropertyMap) which
is accessed directly from C++ code, so its C++ API needs to be accessible
as a regular class in the library, in addition to being registered to the
QML runtime.

Thanks for any help,

-- 

      ...ich hab' noch einen Koffer in Berlin...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240705/41ea0c0c/attachment.htm>


More information about the Interest mailing list