failed to load component after deploying Qt application on Windows using windeployqt
-
I recently converted my Qt application to run on Windows as a standalone application using the windeployqt tool.
However, upon running the generated executable, I encountered the following error in the log:QQmlApplicationEngine failed to load component
qrc:/main.qml:18:1: module "QtQuick.Controls" is not installed
qrc:/main.qml:17:1: module "QtQuick" is not installed
qrc:/main.qml:18:1: module "QtQuick.Controls" is not installed
qrc:/main.qml:17:1: module "QtQuick" is not installedThis error seems to indicate that the required QtQuick and QtQuick.Controls modules are missing. I have verified that the application runs successfully in my development environment Qt Creator .
Could anyone provide insights into how to resolve this issue?
Has anyone encountered similar problems when deploying Qt applications on Windows using windeployqt?
Any suggestions or solutions would be greatly appreciated. Thank you. -
Hello! Could you share the windeploy command you have used to do that? Or at least the --options used
This error seems to indicate that the required QtQuick and QtQuick.Controls modules are missing. I have verified that the application runs successfully in my development environment Qt Creator .
That is because Qt Creator is linked internally to those modules (you can see them under <QT_DIR\qml>
To avoid those errors you can:
- Copy missing modules manually from QT_DIR/qml to your release folder ( I dont recommend this)
- Add the --qmldir . option to the windeployqt command (I am not sure about this as i havent seen your command)
windeployqt --qmldir <path-to-app-qml-files> <path-to-app-binary> windeployqt.exe --qmldir . --release <my_release_folder>\myapp.exe
-
@afalsa Thanks for the solution . it works now I am getting this log QQmlApplicationEngine failed to load component
qrc:/main.qml:252:17: Type View_PdfFile unavailable
qrc:/View_PdfFile.qml:4:1: module "QtWebView" is not installedI installed manually the Qt webView but still it gives the same error
-
@Sachin-Gaikwad Hi.QtWebView is only for Android now.You should use WebEngine Instead.
-
Good news!
You can try to add this to the windeployqt command:
windeployqt --qmldir <path-to-app-qml-files> <path-to-app-binary> -webview -webengine windeployqt.exe --qmldir . --release <my_release_folder>\myapp.exe -webview -webengine
Please check better the documentation link I added above since what I am telling you is indicated at the bottom:
Qt libraries can be added by passing their name (-xml) or removed by passing the name prepended by --no- (--no-xml). Available libraries: bluetooth concurrent core declarative designer designercomponents gui qthelp multimedia multimediawidgets multimediaquick network nfc opengl openglwidgets positioning printsupport qml qmltooling quick quickparticles quickwidgets script scripttools sensors serialport sql svg svgwidgets test websockets widgets xml webenginecore webengine webenginewidgets 3dcore 3drenderer 3dquick 3dquickrenderer 3dinput 3danimation 3dextras geoservices webchannel serialbus webview
In the end, all errors of this type should have the same solution as the one mentioned above.
-