Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.8.1
-
None
Description
Environment
- Windows 11
- Desktop_Qt_6_8_1_MinGW_64_bit-Debug
Issue and how to reproduce
Running the C:\Qt\Examples\Qt-6.8.1\interfaceframework\qface-tutorial\ch4-simulation-behavior example yields a runtime error below:
14:21:28: C:\Qt\Examples\Qt-6.8.1\interfaceframework\qface-tutorial\ch4-simulation-behavior\build\Desktop_Qt_6_8_1_MinGW_64_bit-Debug\ic_ch4.exe を起動中...
QQmlApplicationEngine failed to load component
qrc:/Cluster.qml:8:1: module "Example.If.InstrumentClusterModule" is not installed
Workaround
Add the line below to the main.cpp.
engine.addImportPath(app.applicationDirPath() + "/frontend");
The entire main.cpp after the modification.
// Copyright (C) 2021 The Qt Company Ltd. // Copyright (C) 2019 Luxoft Sweden AB // Copyright (C) 2018 Pelagicore AG // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause#include <QGuiApplication> #include <QQmlApplicationEngine>using namespace Qt::StringLiterals;int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.addImportPath(app.applicationDirPath() + "/imports"); engine.addImportPath(app.applicationDirPath() + "/frontend"); engine.load(QUrl(u"qrc:///Cluster.qml"_s)); return app.exec(); }
Note
This reproduces in qface-ch3, 4 and 5. For 6 and 7, since I'm on Windows and cmake configuration failed due to Unknown CMake command "qt_add_dbus_interface," I couldn't test it, but this should be checked and fixed as necessary.
For 6 and 7, it's been confirmed that the issue reproduces with Desktop Qt 6.8.1 Kit on Ubuntu 22.