Qt Creator Manual

Creating Qt Quick Projects

"New File or Project dialog"

When you create a new Qt Quick project from scratch, you have the following options:

  • Qt Quick Application creates a Qt Quick application project that can contain both QML and C++ code. The project includes a QDeclarativeView. You can build the application and deploy it on desktop and mobile target platforms.

    You can select a template that uses either the built-in QML elements or Qt Quick components for a particular platform. The built-in QML elements enable you to create cross-platform applications with a custom look and feel, whereas the components provide the look and feel for a particular platform.

  • Qt Quick UI creates a Qt Quick UI project with a single QML file that contains the main view. You can review Qt Quick UI projects in the QML Viewer and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of projects.
  • Qt Quick Application (from Existing QML File) converts existing QML applications to Qt Quick application projects. This enables you to run them from Qt Creator and to deploy them to mobile devices.
  • Custom QML Extension Plugin (in the Libraries category) creates a C++ plugin that makes it possible to offer extensions that can be loaded dynamically into applications by using the QDeclarativeEngine class.

Note: Qt 4.7.3 supports Qt Quick 1.0 and Qt 4.7.4 supports Qt Quick 1.1. The application wizards import Qt Quick 1.1, and therefore, you can use them without changes if you target only platforms that run Qt 4.7.4 (such as MeeGo or the desktop). If you also target platforms that run Qt 4.7.3 (such as Maemo and S60 5th Edition), you must change the import statement to import Qt Quick 1.0.

Creating Qt Quick UI Projects

  1. Select File > New File or Project > Applications > Qt Quick UI > Choose.

    The Introduction and Project Location dialog opens.

    "Introduction and Project Location dialog"

  2. In the Name field, give a name to the project.

    Do not use spaces and special characters in the project name and path.

  3. In the Create in field, enter the path for the project files. For example, C:\Qt\examples. To select the path from a directory tree, click Browse.
  4. Click Next.

    "Project Management dialog"

  5. Review the project settings, and click Finish to create the project.

Qt Creator creates the following files:

  • .qmlproject project file defines that all QML, JavaScript, and image files in the project folder belong to the project. Therefore, you do not need to individually list all the files in the project.
  • .qml file defines an element, such as a component, screen, or the whole application UI.

The import statement in the beginning of the .qml file specifies the Qt modules to import. Each Qt module contains a set of default elements. Specify a version to get the features you want.

To use JavaScript and image files in the application, copy them to the project folder.

Creating Qt Quick Applications

  1. Select File > New File or Project > Applications > Qt Quick Application (Built-in Elements) > Choose.

    Note: We recommend that you use the Qt Quick Application for MeeGo Harmattan template when you develop for MeeGo Harmattan devices and the Qt Quick Application for Symbian template when you develop for Symbian devices that support Qt 4.7.4, or later.

    The Introduction and Project Location dialog opens.

    "Introduction and Project Location dialog"

  2. In the Name field, give a name to the project.

    Do not use spaces and special characters in the project name and path.

  3. In the Create in field, enter the path for the project files. For example, C:\Qt\examples. To select the path from a directory tree, click Browse.
  4. Click Next.

    The Target Setup dialog opens.

    "Target Setup dialog"

  5. Select the Qt versions to use as build targets for your project, and then click Next.

    Note: Qt Quick is supported since Qt 4.7, and therefore, only Qt 4.7 and later versions are displayed. Further, if you have only one supported Qt version installed, this dialog is skipped.

    The Mobile Options dialog opens.

    "Mobile Options dialog"

  6. In the Orientation behavior field, determine how the application behaves when the orientation of the device display rotates between portrait and landscape, and then click Next.

    Note: This dialog opens only if you select Maemo5 or Symbian Device target in the Target Setup dialog. On Harmattan, the Qt Quick Components for MeeGo provide native-looking rotation.

    The Symbian Specific dialog opens.

    "Symbian Specific dialog"

  7. In the Application icon (.svg) field, select an application icon for the Symbian Device target, or use the default icon.
  8. In the Target UID3 field, specify the Application UID, or use the default UID.

    Note: Qt Creator generates a UID for testing the application on a device. You need to change the UID when you deliver the application for public use.

  9. Click Next.

    The Harmattan Specific dialog opens.

    "Harmattan Specific dialog"

  10. In the Application icon field, select the application icon to use on Maemo or Harmattan targets, or use the default icon.

    The Project Management dialog opens.

    "Project Management dialog"

  11. In the Add to project field, you can add this project to another project as a subproject.
  12. In the Add to version control field, you can add the project to a version control system.
  13. Click Finish to create the project.

Qt Creator creates the necessary boilerplate files. Some of the files are specific to the Symbian, Maemo, or MeeGo Harmattan platform.

Importing QML Applications

If you have existing QML applications that you want to run in Qt Creator or deploy to mobile devices, select the Qt Quick Application (from Existing QML File) template to import the main .qml file in your project.

"Select Existing QML File dialog"

All the other files in the project are automatically added to the application project. Qt Creator adds references to the QML files to a project and creates the additional files necessary for deploying applications to mobile devices.