[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!
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.
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:
- QDeclarativeView view;
To access the file itself:
- QFile file(":qml/myqmlfile.qml");