Making a QML file into a project resource

You can create a Qt resource file that includes the QML file that defines the UI. After you add this resource file to your project, Qt Creator will include the UI definition in the binary file.

Note: There are several ways to access resources in Qt apps running on a QNX CAR system. In addition to compiling resources into their binaries, apps can access resources from within their Blackberry ARchive (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 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 specific file types (shown in the middle), then click Choose...

    Qt Creator displays the New Qt Resource file configuration dialog.

  3. In the Location page, 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 Projects view, select the resources.qrc file, then click Add in the configuration area near the bottom, then choose Add Prefix.
  6. In the Prefix field, replace the default text with ui.
  7. Click Add again, then choose Add Files.

    Qt Creator opens a file selector so you can navigate to the file you want to include in the resource.

  8. Select main.qml and 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.