maybe someone have an idea how fix such problem: By following that tutorial https://doc-snapshots.qt.io/interfaceframework/qtinterfaceframework-interfaceframework-qface-tutorial-example.html and using examples I managed to create working simulation backend.
So if my project structure looks like that:
-root
--CMakeLists.txt
--app
--CMakeLists.txt
--src
--res
--backend_simulator
--CMakeLists.txt
--frontentd
--CMakeLists.txt
--imports
--CMakeLists.txt
main.cpp:
QQmlApplicationEngine engine;
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
// adding my imports folder
engine.addImportPath(app.applicationDirPath() + "/imports");
engine.load(url);
Everything works well, but only if I moved imports
, backend_simulator
and frontend
into new middleware
folder which simply added those folders by CMakeLists, plugin cannot be loaded.
-root
--CMakeLists.txt
--app
--CMakeLists.txt
--src
--res
--middleware
--CMakeLists.txt
--backend_simulator
--CMakeLists.txt
--frontentd
--CMakeLists.txt
--imports
--CMakeLists.txt
My import path is also changed to:
engine.addImportPath(app.applicationDirPath() + "/middleware/imports");
During runtime I got:
path/to/build/my_module.dll: The specified module could not be found.