QML Module not found
-
Hi,
The problem
I made a working backing library and plugin in Qt Creator. I'm trying to have Qt Design Studio see it but I can't find how.
The line:
import Charts
Gives me the error:
Import paths: /home/tvanbesi/Desktop/Qt-sandbox/Sandbox-Debug/PieChart /home/tvanbesi/Desktop/Qt-sandbox/Sandbox/. /home/tvanbesi/Qt/Tools/QtDesignStudio/qt6_design_studio_reduced_version/qml For qmake projects, use the QML_IMPORT_PATH variable to add import paths. For Qbs projects, declare and set a qmlImportPaths property in your product to add import paths. For qmlproject projects, use the importPaths property to add import paths. For CMake projects, make sure QML_IMPORT_PATH variable is in CMakeCache.txt. For qmlRegister... calls, make sure that you define the Module URI as a string literal.
What I tried
The error message says:
For qmlproject projects, use the importPaths property to add import paths.
Correct me if I misunderstood something, but Qt Design Studio needs theqmldir
and.qmltypes
files to be able to "see" the module.
And since Qt Creator compiles the library and plugin, I can see theqmldir
and.qmltypes
files in the build directory:
So I figured I could just update the.qmlproject
importPath property with the path to the build directory:
importPaths: [ ".", "/home/tvanbesi/Desktop/Qt-sandbox/Sandbox-Debug/PieChart" ]
(I know Qt Design Studio shouldn't rely on Qt Creator generated stuff but it's just to make it work and try to understand now.)But it doesn't work. How am I supposed to do it exactly? How can I get a log of what fails when Qt Design Studio tries and fails to load the module plugin?
-
So I found the problem if anybody has the same problem:
You need to build the module as a plugin, i.e. a dynamic .so library (or .dll on Windows). Then use the import path of the folder containing the
.so
,qmldir
and.qmltypes
files, not the folder itself!e.g. for me it works with the Qt Creator build output folder:
"/home/tvanbesi/Desktop/Qt-sandbox/Sandbox-Debug/qml"
-