In our existing code we call `qmlRegisterType<...>(...)` in our regular C++ code (e.g., some shared libraries that the main application links to). I thought that, to be able to use those types in stand-alone QML code, I'd need to move these calls into plugins, or at least have some QML extension module link to these libraries so they can see these types. What am I missing ?

You are getting this fundamentally wrong. When using qt_add_qml_module you do not have to call any qmlRegisterType at all. qmltyperegistrar and CMake do all of this behind the scenes and relieve you from the pain of maintaining your plugins, type registration calls, qmltypes files, versions, metaobject revisions and all the other cruft you have to do in Qt5. You can easily have modules that contain both QML files and C++-based types now, too.

All you need to do is make sure the resulting modules end up in an import path that's visible to your application. The easiest way to do this is place them in directories named by the module URIs (with dots replaced by directory separators) directly below the application directory. That is, no directory named "qml" or other shenanigans between the modules and the application.
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to