To test the deployment of QML, I created a very simple QML application. Here is the code:
main.cpp
#include <QApplication> #include <QQmlApplicationEngine> #include <QFile> int main(int argc, char **argv) { QApplication app(argc, argv); QQmlApplicationEngine engine; QString path = app.applicationDirPath() + "/qml/main.qml"; if(QFile::exists(path)) engine.load(path); else { return 1; } return app.exec(); }
main.qml
import QtQuick 2.2 import QtQuick.Controls 1.2 ApplicationWindow { id: mainWindow title: "Test window" width: 800 height: 600 visible: true }
To make sure that the development library is not installed on the system, I set up a virtual machine with a clean installation of Windows XP. Then I followed the instructions described here and copied all Qt5 * .dll to the program directory, as well as the /qwindows.dll and icu * 52.dll platforms. Dependency Walker confirmed that there were no broken dependencies, i.e. Everything must be properly configured.
However, for some reason, when I run my application, I see nothing. Neither a window nor an error message. Running from the console also gives me no error. Despite this, I see that my application is running in the task manager, for example, running in the background. Running the application on the development machine goes without problems: the application starts correctly, and I see its windows.
What am I doing wrong? How can I deploy a QML application to make sure that it will work on any other machine without development?
source share