[SOLVED] Qt Quick Application: empty window

  • Default project 'Qt Quick Application' created and maked. It shows "Hello World" on 'Ctrl+R', but exe running give empty window. Any idea? Thanks!

  • Looks like your qmls are located in wrong path.

  • Unfortuantely the default project does not pack the qml file into a resource. That means the qml-file may get lost easily. The build script has deployment options to copy the qml file, however I find this very brittle. Bottom line:

    • Make sure that the qml file is located where it is expected by the executable.
    • To get a stable solution put the qml file in a resource.

  • Ok. Thank you!
    Can you explain me about putting qml into resource, please?

  • Sure:
    Select in Creator: File->New->Qt->Resource file
    This will add a resource file to your project and give you a graphical editor that permits to select files which will be included in the binary file. Next step is to access the files that reside inside your executable:

    As URL:

    @QDeclarativeView view;

    To access the file itself:
    @QFile file(":qml/myqmlfile.qml");@

  • Yeah! Excellent! Thanks a lot!

  • I'm having the same issue, but these suggestions didn't help.

    I'm using the newest version of QT Creator on Windows 8.

    It works perfectly if I go to the debug build directory and double click on the .exe file, but when I run the applications from Qt Creator using the big great play button it just shows an empty window.

  • The latest versions of Qt Creator take care of the original problem stated here because the main.qml file is put inside a qml.qrc resource file by default. Did yours do this? If not you might not be on the latest (right now 5.2.3 - but its been doing this for a while). Other than that I would suggest taking a look at the Projects mode and switch to the Run tab and see if possibly something got mucked up on the Working Directory line. It should point to that same folder where you are manually double-clicking.

Log in to reply