4

I just finished writing a QML desktop application(with QtCreator and c++) on Windows.

I've installed QT Quick Desktop Components, according to these instrctions, with MinGw compiler, in C:\QtSDK\Desktop\Qt\4.7.4\mingw\imports\Qt\labs\components folder.

I installed it twice - once for debug - with the command: qmake && jom debug && jom install, and once for release - with the command: qmake && jom release && jom install, so I have now two dll files: 1.styleplugin.dll, 2.styleplugind.dll. and I'm using each of them when I need it. I've imported it to my application with:

import Qt.labs.components 0.1

Now I have to deploy my application, and make it work on all the machines: with Qt installed on it, or with no.I tried to do it with these steps:

coppied these files: application.exe, QtCore4.dll, QtGui4.dll, QtNetwork4.dll, styleplugin.dll and styleplugind.dll.

but when I'm running the .exe file - I'm getting a white, empty screen.

(BTW, when I'm running the .exe file from it's release folder - I can see again only a white window, and when I did the same to a simple Widget GUI application - it runs well from there).

Do you know about any reason to this situation?

Any answer would be appreciated!

Community
  • 1
  • 1
user1835297
  • 1,059
  • 2
  • 12
  • 24
  • Ad what's the output in your application log? I bet it would help you to find the solution – TheHuge_ Nov 25 '12 at 14:58
  • Qt Creator's default run configuration runs the .exe from project/, not from project/release/, and if the .qml file lookup is done relative to the .exe run path, the .qml files may not be found. Try moving the .exe one folder up and check the run configuration settings (to see if setting run path to /release breaks things in the same way you see on target) – mlvljr Nov 25 '12 at 20:18
  • Please respond to answers or accept them – Maarten Bodewes Dec 16 '12 at 15:56

2 Answers2

2

May be you forgot deploy QML files to exe? (qrc)

Simple way to test it, is to copy the folder with qml-files to destination near .exe file.

Please read Qt Resource System documentation:

I.e.

  • First need add new "Resource File" in project menu,
  • Then place all of your qml files into this resource file
  • Change "Source" in your QDeclarativeView like this:
    viewer->setSource(QUrl("qrc:/main.qml"));
    
Dcow
  • 1,413
  • 1
  • 19
  • 42
0

One possible solution is to enable warnings by running the command

qmlviewer.exe -warnings show qmlfilename.qml

If qmlviewer cannot find any dependent import libraries, it will show up here.

To make sure qmlviewer can access the import libraries either use the -I <directory> on the command line OR set the QML_IMPORT_PATH environment variable to the folder containing the import libs.

eg:

qmlviewer.exe -warnings show -I <directory> qmlfilename.qml

OR

set QML_IMPORT_PATH=<directory>

where <directory> is the module import search path (without the <>)