QML Designer Path Resolving
-
I've been working with QML Designer (inside QtCreator) and I found myself into lot of troubles.
I've a QML C++ plugin in a library project, with lots of QML files loaded into resources, and I have my QML application using the plugin and the qml files, in another project.
It's surprisingly difficult to setup an environment where QtCreator and Qml Designer both recognize the QMLs from the library. Playing with QML_IMPORT_PATH is not helping very much. QtCreator doesn't recognize the components imported from the library, even if the paths are correct, and QML Designer gives an M300 error, unknown component.
If I use a relative import path (just as a temporary test), like
import "path/to/library" 1.0
instead of
import Library 1.0
QtCreator starts to recognize the components (the red underline disappears) QML Designer starts to open the files again without M300, but I have nothing in the QML Types tab (I cannot drag and drop anything from the library).
What is the correct way to make the QML Designer load and recognize any qml component from any folder, specifying paths? I want to have my components from the library available in the QML Designer ui.
Thank you.
-
Using QML_IMPORT_PATH in the .pro file should work. you have to specify the directory containing the imports e.g. : "path/to".
To add items to the item library you have to add a .metainfo file to your plugin. You can find an example here: