Deployment of QML/C++ app on windows
-
I am used to develop C++ applications on windows and started some time back to have also qml apps on Android.
To one of my C++ apps a QML interface was added and I can run it without problems on Android. Creation and deployment is done through Qt creator. The combined app can be compiled also on windows and it runs without issues.
A while ago I have noted that apparently my MinGW 64 versions have issues after a while. Multiple reinstalling of Qt 64 bit version did not help at all. Today I had the same issue starting. My application started to complain about a QML import not possible when starting through creator.
qrc:/EdgeGui.qml:8:1: module "QtQuick.Controls" is not installed import QtQuick.Controls 2.15
Last thing done before was adding all required dlls to the folder with my exes. When removing the dlls fromfolder I could start my app through creator again, which solved the mystery I experienced for a while.
Therefore something must be missing when I am copying all dlls to the exe folder. I am used to do it manually.
Finally I convinced myself to use windeployqt. However, also when using windeployqt and I start the app directly from the folder I will receive the error message again.
What am I missing?
-
Hi @koahnig
since you now tried to use
windeployqt
did you give it the correct qmldir parameter ? It is usually the main reason for deployment issues of QML applicationsAre those QML import complains actual errors ? as in the program does not launch correctly or closes abruptly ? Sometimes I have "missing" includes and imports that are pure QtCreator issues and compiles and runs everything just fine.
-
Hi @J-Hilk
No, I did not use the qmldir parameter. Which is the correct qml folder?
windeployqt has been used only with the app name as parameter respectively with the actual folder name where app resides. windeployqt was started on command line with its full location folder name in use.
One dll was still missing after windeployqt run which has been added manually (QtSerialPort).
The app can start but the qml window of app is considerably smaller and empty. The error message is displayed in command window. The app is apparently stuck in an endless loop during startup.
-
@koahnig you give it the path to the folder of your very own top most *.qml file (usually the folder that contains main.qml)
The tool will than parse all qml files in that folder + all subfolders and check all imports and copy the related files and dll's
If you do not give the tool that path (or the correct one) you will indeed end up with a white scene, as nothing could be loaded :D
-
Interesting!
The help text says:
--qmldir <directory> Scan for QML-imports starting from directory.
I have not imagined your interpretation. With trial and error the mingw folder (basically where also the bin folder of windeployqt is) has been used without any change of the situation. Next trial was directly the qml folder in that folder. The output of windeployqt was very different from runs before. Moreover it solved the issue. I could start the application from command prompt without the error message. BTW the actual qml folder of my app is not nearby at all. I assume that there is no way windployqt could know.
Will continue with some tests if the ifw can be used now successfully.
-
@koahnig great that it works now!
the deployment tool generally fetches to much, according to the "better save then sorry" principle
if you point
qmldir
to the Qt-Framework installation, and the qml files there, the tool will quite literally fetch everything qml related :DI highly recommend the path to your own QML-File-Folder