I try to create an application in which I use rcc modules but I get the error "modules not installed".
I have the following folders and files:
MainFolder
|_Folder1
|_Folder11
|_qmldir
|_MyButton.qml
|_Folder2
|_qmldir
|_MyComponent.qml
Application
|_application.pro
|_main.cpp
|_main.qml
|_rccFolders
|_folder11.rcc
|_folder2.rcc
My qmldirs contain:
In Folder11:
module MainFolder.Folder1.Folder11
MyButton 1.0 MyButton.qml
In Folder2:
module MainFolder.Folder2
MyComponent 1.0 MyComponent.qml
The main.cpp:
#include ...
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QString sourcePath="C:/path_to_rcc_files/";
QQmlApplicationEngine engine;
QResource::registerResource(sourcePath+"folder11.rcc");
QResource::registerResource(sourcePath+"folder2.rcc");
engine.addImportPath(":/"); //to use .rcc files
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}
The main.qml:
//QML imports
import MainFolder.Folder1.Folder11
import MainFolder.Folder2
ApplicationWindow
{
...
}
But when I execute the application, I get:
qrc:/main.qml:... module "MainFolder.Folder1.Folder11" is not installed
qrc:/main.qml:... module "MainFolder.Folder2" is not installed
What is wrong in my code? Thanks.
You may debug resource problems (go to Debugging section at the end) using
QML_IMPORT_TRACE
It says
import <ModuleIdentifier> <Version.Number> [as <Qualifier>]
so be sure to try: