How to deploy QML Application with QtCharts module by using windeployqt
-
I wanna package my application by using windeployqt, however, the charts components didnt show up.
I already tried to copy QtCharts folder and Qt6Charts.dll manully like what I did with Qt5, but it didnt work.
The Qt version is 6.2.0, anybody can help? -
@LCVitality QtCharts is a Qt add-on, and as such doesn't appear to be directly supported by
windeployqt
. (I'm basing that on the fact that it isn't listed as an "available library" bywinqtdeploy --help
, even when it's installed in the Qt build being deployed:After installing Qt 6.2.1, both MSVC and MinGW, using the online installer...
C:\> cd Qt\6.2.1\msvc2019_64\bin C:\Qt\6.2.1\msvc2019_64\bin>set PATH=%cd%:%PATH% C:\Qt\6.2.1\msvc2019_64\bin>windeployqt.exe --help # [...] 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 gamepad 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 winextras xml webenginecore webengine webenginewidgets 3dcore 3drenderer 3dquick 3dquickrenderer 3dinput 3danimation 3dextras geoservices webchannel texttospeech serialbus webview shadertools
Meanwhile, in a MinGW64 bash shell...
$ cd /C/Qt/6.2.1/mingw81_64/bin $ export PATH=$(pwd):$PATH $ ./windeployqt.exe --help # [...] 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 gamepad 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 winextras xml webenginecore webengine webenginewidgets 3dcore 3drenderer 3dquick 3dquickrenderer 3dinput 3danimation 3dextras geoservices webchannel texttospeech serialbus webview shadertools
(...I have no idea why
webengine
,webenginecore
, andwebenginewidgets
are listed there — it would've been a major coup if they were available in MinGW Qt6, but I triple-checked and they are, in fact, not. Which must mean that thewindeployqt
library list is hardcoded, not actually generated to reflect the installed components as I'd hoped/assumed. Laaaaame.)Still, no Charts listed on its disappointingly-hardcoded list of supported libraries.
-
@FeRDNYC Thanks for reply.
I understand QtCharts is not supported by windeployqt.
In Qt5, afterwindeployqt path/to/executable.exe --qmldir path/to/qml
I need to copy QtCharts folder and Qt5Charts.dll to the directory of the executable.exe, then run the executable, QtCharts works well.
I did the same thing in Qt6, but it didnt work.
I wanna know is there any approch works for Qt6?
Thanks again. -
I have the same problem...
Were you able to resolve the problem?
I'm on Qt 6.2.4, QtCharts is installed with the MaintenanceTool, but- windeployqt.exe does not recognise QtCharts as a dependency
- It can't be added manually with -qtcharts or - charts
- Manually copying the .dll and the Folder from the qml folder does not work
-
I solved it,but I am not sure if Qt engineer upgraded windeployqt.exe.
I'm on Qt 6.3.1,msvc2019_64.
The windeployqt.exe can create QtCharts libraries directly (QtCharts folder ,Qt6Charts.dll and Qt6ChartsQml.dll).
And copy folder and dll still doesn't work.I guess, many people use windeployqt.exe incorrectly.
If you can run your qml program with Qtcharts module in VS or Qcreater, it could create library by windeployqt.exe.windeployqt path/to/executable.exe --qmldir path/to/qml
The qmldir path should be your progarm‘s qml’s folder instead of qt‘s or qtcreator’s folder.
My folder include main.qml, such aswindeployqt D:\C++\test\x64\Release\test.exe --qmldir D:\C++\test\test\
instead of
windeployqt D:\C++\test\x64\Release\test.exe --qmldir D:Qt\Qt6.3.1\msvc2019_64\qml
-
@xyzwei Wow, indeed this seems to work.
It's amazing how poorly documented everything in QT is .. even the forums give mostly wrong/partial answers and you need to waste hours just to find the ones that work.
By the way, the final command that worked for me, in case anyone needs, is:
windeployqt --release --qmldir C:\path\to\project executable.exe
-
@Developer123 hi! im using qt with a .pro file and mingw. i dont have a qml file. what can i do? i have the same problem
-
@Vlogo11 What do you mean you "have the same problem"? What problem do you have? Have you even built your application yet?
(Because, the fact that you're using a
.pro
file should be irrelevant,windeployqt
is run on the.exe
file that results from building your application. Whether you're using CMake or qmake, you need to generate a build system and compile your application before you can do anything withwindeployqt
.)Once you have an application executable, just run
windeployqt myapplication.exe
on the compiled program. If you don't have any QML then you don't even need to worry about--qmldir
at all.