Deploy Qt5 QML application
If you use MinGW, then try to copy all folders from folders qml and plugins to directory with your program. Also copy libraries: icudt52.dll
, icuin52.dll
, icuuc52.dll
, libgcc_s_dw2-1.dll
, libstdc++-6.dll
, libwinpthread-1.dll
, Qt5Core.dll
, Qt5Gui.dll
, Qt5Network.dll
, Qt5Qml.dll
, Qt5Quick.dll
, Qt5Svg.dll
, Qt5Widgets.dll
from bin
Eventually the directory will look like this:
- Enginio
- imageformats
- platforms
- Qt
- QtGraphicalEffects
- QtPositioning
- QtQml
- QtQuick
- QtQuick.2
- QtSensors
- QtWebKit
- QtWinExtras
- icudt52.dll
- icuin52.dll
- icuuc52.dll
- libgcc_s_dw2-1.dll
- libstdc++-6.dll
- libwinpthread-1.dll
- Qt5Core.dll
- Qt5Gui.dll
- Qt5Network.dll
- Qt5Qml.dll
- Qt5Quick.dll
- Qt5Svg.dll
- Qt5Widgets.dll
- YOUR_PROGRAM.exe
This way works on WindowsXP/Win7 where Qt was not installed.
This what i've figured out so far,
You can't just open a qml file in main.cpp, you have to put those qmls into a resource
qml.qrc:
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>
Then main.cpp must load it from the resource
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}
then build and check it works, then deploy as follows:
- locate the releasse directory where your EXE lives
- locate the directory where your QML lives
- create a directory somewhere, say, deploy
then
cd deploy
windeployqt --release --qmldir <qml-dir-location> <exe-location>
NOTE: add location of windeployqt to PATH eg. C:\Qt\Qt5.5.1\5.5\msvc2013\bin