Closed ahayzen-kdab closed 1 month ago
When I've tried to reproduce this locally, I got this error message:
thread 'main' panicked at /home/ben/cxx-qt/crates/qt-build-utils/src/lib.rs:860:17:
qmltyperegistrar failed for com.kdab.cxx_qt.demo:
Error: /home/ben/cxx-qt/target/debug/build/qml-minimal-no-cmake-2e43c9623c960347/out/moc_shoop_rust_callable.cxxqt.h.cpp.json:: Failed to parse JSON: 5 illegal value
Is this similar to what you found?
@BenFordTytherington Sorry for the late response - I accidentally turned off notifications. Yes, that's exactly the error I got. I interpret that as trying to run moc on a C++ file without any moc-able objects in it.
Hm, that actually seems like it's not moc that's the issue, but rather qmltyperegistrar.
Although the two are somewhat related, that's not the same thing. First we run moc to expand any of the Qt macros. I think this can handle C++ files without a Q_OBJECT, as it should handle that in a C++ project as well. However, we then run qmltyperegistrar to create a QML plugin that automatically registers all the necessary types.
This then fails, as we seem to pass it the wrong data. Probably because it's trying to register a type from a file that doesn' have one.
You may be able to get around this by defining the bridge not in a QML module, but just as a normal bridge in the CxxQtBuilder.
But we should of course fix this for QML modules as well.
Discussed in https://github.com/KDAB/cxx-qt/discussions/1032