Making a QML file into a project resource

After you've defined the UI in a QML file, you can create a Qt resource file that includes the QML file and then add this resource file to your project. This makes Qt Creator include the UI definition in the binary file.

Note: There are several ways to access resources in Qt apps running on a QNX Apps and Media system. In addition to compiling resources into their binaries, apps can access resources from within their BAR file package or from a shared location on the target. It's also possible to use a mix of any of these options. The best solution depends on the nature of the app.
To make the UI-defining QML file into a project resource:
  1. Click the Edit icon on the left side, right-click the QtApp folder in the Projects view, then choose Add New...
  2. In the New File dialog, select Qt in the Files and Classes list, then Qt Resource file in the list of file types (shown in the middle), then click Choose...
  3. In the Location page of the New Qt Resource file dialog, name the file resources, then click Next.
  4. In the Summary page, click Finish.

    A new file, resources.qrc, has been added to the project. The Qt Resources Editor is open.

  5. In the configuration area near the bottom, click Add, then choose Add Prefix.
  6. In the Prefix field, replace the default text with ui.
  7. Click Add again, then choose Add Files.
  8. In the file selector that Qt Creator opens, navigate to the project directory and select main.qml, then click Open.
The main.qml file is stored in a Qt resource (.qrc) file, which means Qt Creator will compile the QML file into the app binary file.