Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Developing project with multiple apps and common QML module/library in Qt Creator
molesmoke last edited by
I've been looking for a while for information or an example on how to structure a project with multiple apps that reference a common QML module (with both C++ and QML files). Whilst there is an example (http://qt-project.org/doc/qt-5.1/qtqml/qqmlextensionplugin.html), its seems a little too vague for me to understand how the actual shared library (.so/.dll) and QML are supposed to be built and installed and then referenced by an application.
It would be great if the TimeExample had an actual complete subdirs project that showed the library being built as one sub-project and another sub-project that was an application using it - it must surely be a common development situation.
As an example, using Qt Creator, I would like to have the following project structure:
Say that qmllib contains both QML items provided through *.cpp (via QQmlExtensionPlugin) and *.qml files (similar to the TimeExample in the documentation). How should app1 and app2 be configured to use qmllib? I can't see how this is intended to work, especially in conjunction with Qt's shadow build feature - the shared library will be built in one directory, but the qml and qmldir files will exist in another.
In some of the Qt examples, qml files are used as resources (*.qrc) - this seems like it could be a nice approach to solving this issue (since they would become part of the shared library), but I can't find any information on creating qmldir files that reference types defined in resources.
If anyone could shed some light on a good approach I would be most grateful!