MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

Creating and running a Hello World application with Qt SDK

This section demonstrates how to:

  1. Create a project and write a Harmattan Hello World application.
  2. Select the target.
  3. Run the Harmattan Hello World application.

Prerequisites

Note: The files that the Qt SDK creates for this example application are described in the section Anatomy of an application.

Creating a project

Note: When you create a project, Qt Creator automatically creates a Hello World skeleton.

To create a project:

  1. Start Qt Creator and select File > New File or Project.
  2. Select Qt Quick Application and click Choose....
    Selecting a project in Qt Creator
  3. Name your project, select where you want to save it, and click Next.
    Note: Make sure that the path to the location does not contain spaces.
    Introduction and project location in Qt Creator
  4. Select Qt Quick Components for MeeGo/Harmattan as the application type.
    Selecting the application type
  5. To create a project that can be run on Harmattan emulator (QEMU) or on Harmattan device, select Harmattan as target and click Next.
    Note: You can also select other targets - such as the Qt Simulator - that you may want to run your application on.
    Selecting target setup in Qt Creator
  6. Select the default icon for your application, and verify that Make application boostable is selected. A boosted application has an improved startup time. For more information, see Optimising application startup.
    Selecting application icon
  7. Click Next.
  8. Check that the project summary is correct and click Finish.
  9. Add the packaging files created by Qt Creator to your project by clicking Yes.

Your project has now been created.

Selecting the run target

A run target is the environment that the application is set to be launched in. For Harmattan software development, the available run targets are two different emulation environments - Qt Simulator and QEMU - and the actual Harmattan device.

Due to the accuracy of QEMU emulation level, both QEMU and Harmattan device are visible to Qt Creator as Harmattan devices. To run your application in QEMU, you need to set Qt Creator to build and run your application in Harmattan and then select QEMU from further options, as described in the following section.

When developing an application, you can select the run target every time you build and run your application.

For more information on the different run targets and their emulation, see section Emulation tools.

For more detailed information on using build targets in Qt Creator, see Building and Running Applications in Qt Creator documentation.

Selecting Harmattan (QEMU or device)

Prerequisite

QEMU or device configured in Qt Creator.

To run your application in Harmattan emulator or device:

  1. Switch to Projects mode button.
  2. On the target toolbar above Build Settings, select Harmattan > Run to configure the run settings.
    File:Nokia_Qt_SDK_target_bar.png
    In the Device Configuration drop-down menu, select the emulator or device configuration.
  3. Click the Target Selector Target Selector and select whether you want to build your project with Debug or Release configuration.
Use Debug if you want to debug your application. Use Release if you only want to run your application.
File:Nokia Qt SDK EmuTargetSel.png
Your project is now configured for running in Harmattan emulator or device.

Selecting Qt Simulator

To run your application in Qt Simulator:

1. Click the Target Selector Target Selector and select Qt Simulator.
2. Click the Build line to select whether you want to build your project with the Debug or Release configuration.
Use Debug if you want to debug your application. Use Release if you only want to run your application.
File:Nokia Qt SDK SimTargetSel.png
Your project is now configured for running in Qt Simulator.

Running Hello World

You can run your application on your device, or in Qt Simulator or QEMU.

Running Hello World on a device

Prerequisite

Connecting the device to Qt SDK.

To run your application on the device:

  1. Click the Target Selector File:Nokia Qt SDK project icon.png, and select Harmattan and the configuration you are using.
    The application is built before it can be run on the device. Above the Target Selector, Qt Creator displays Evaluating, Parsing, and Scanning status bars. Wait until the processes are complete.
  2. Click Run.
    Your application is installed on the device. After installation, the application runs on the device.

├Łou can affect many options with the run settings. For more information, see the Specifying Run Settings in Qt Creator documentation.

Running Hello World in Qt Simulator

  1. Click the Target Selector File:Nokia Qt SDK simulator icon.png, and select Qt Simulator and the configuration you are using.
    The application is built before it can be run in Qt Simulator. Above the Target Selector, Qt Creator displays Evaluating, Parsing, and Scanning status bars. Wait until the processes are complete.

To run your application in Qt Simulator, click Run.

Your application runs in Qt Simulator.

Running Hello World in QEMU

Prerequisite

QEMU configured in Qt Creator. To check the configuration, see Checking QEMU configuration.

To run your application in QEMU:

  1. Click File:Qt Creator emulator button.png to start QEMU.
  2. Click the Target Selector File:Nokia Qt SDK project icon.png, and select Harmattan and the configuration you are using.
    The application is built before it can be run in QEMU. Above the Target Selector, Qt Creator displays Evaluating, Parsing, and Scanning status bars. Wait until the processes are complete.
  3. Click Run.
    Your application runs in QEMU.