White screen on launching application - Qt QML
-
Hello everybody,
i followed this guide to deploy an Application on Windows ("Here":http://qt-project.org/wiki/Deploy_an_Application_on_Windows).I did steps 1, 2, 3 and 4. But when I launch the exe, I have a white screen with no error message.
Have you an idea of my mistake please?
Thanks.
-
White screen is usually shown when the QML engine encounters an error (missing QML file, wrong import, etc.). You need get the stderr output for that application, it will tell you exactly what went wrong. On Windows I think you can also inspect some system logs and the messages will be there.
-
Ok, but Qt is new for me :(
How can I get the stderr output when I run this application as a standalone app and not in Qt Creator ? -
Have you tried using the Windows command line to start your exe
-
No, i didn't.
I'll do that tomorrow and I'll let you know :) -
Ok, I just try to use WIndows command line to start the exe but there is no message displayed :(
-
That is because Windows is crap. Don't worry, you can still read the logs. Try "this":http://stackoverflow.com/questions/482678/how-to-capture-stderr-on-windows-dos or "this":http://support.microsoft.com/kb/308427.
-
There is no displayed error for both methods.
Should I deploy the application in debug or release? It is currently in release. -
Good idea, try with a debug build.
-
No message either :(
I read on forums that it could be a problem for QML plugin. However, I have imported all the files listed in the tutorial. -
I just found a solution.
I added in the application folder a directory qml/APPLICATION_NAME/ with qml files. Now it works.So I have a question. Is it mandatory to add the folder or can it be included in the exe?
-
It is not mandatory. You can include all QML files (and other files, too) using "Qt Resource Sytem":http://qt-project.org/doc/qt-5/resources.html.
-
Ok, thank you very much. This is very useful !
However, do you know how to automate this in QtCreator? -
Yes, Qt Creator will basically do all the work for you, don't worry. Just open your project and select Add New...->Qt->Qt Resource File. It will add the file, and you can put your QML files there through an easy, built-in GUI tool.
You also need to change one thing in your code: when you set the main QML file source (to QtQuick2ApplicationViewer, QQuickView, QQmlEngine, etc.), you need to change the path to this:
@
:/prefix/myMainQmlFIle.qml
//or
qrc:///prefix/myMainQmlFIle.qml
@ -
Ok, thank you for your answers, I learned a lot from you :)
Have a good day.
-
Thank you, you are welcome :-)