This section describes building the application for a Harmattan target and deploying the application on a Nokia N9. To enable the convenient deployment and debugging of the application on the Nokia N9, you need to install software on the phone to enable USB and WLAN connections with the Qt SDK. Some configuration is required in Qt Creator also.
Prerequisites
To build and run Qt applications on the Nokia N9, you need the following:
- a Nokia N9 with USB cable.
- Qt SDK.
- a computer running*:
- 32- and 64-bit Linux;
- 32- and 64-bit Windows.
* Qt Creator uses the Maemo Application Development and Debugging Environment (MADDE) to build, deploy and debug your applications. Unfortunately this environment is not available for Apple Mac OS X.
Set up the Nokia N9 and Qt Creator
To develop for the Nokia N9, you must first enable the developer mode on the device: To do this open 'Settings' from the application menu and select 'Security' from the list of settings. Then navigate to 'Developer mode' view and enable the mode by flicking the switch in the menu item. Accept all possible requests. The phone will download and install all the necessary tools required for application development. Additional tools can be installed manually in 'Developer mode' view (see figure 23).
Figure 23: Developer mode view in settings.
Connecting the phone to PC
You can connect your Nokia N9 to your development PC using a USB or WLAN connection.
You need to use the SDK Connectivity tool, which was automatically installed when the developer mode was enabled, to create
the phone-side endpoint for a USB or WLAN connection.
Note: This section covers use of the USB connection. Please visit the MeeGo 1.2 Harmattan Developer Library for instructions on how to connect using WLAN.
Connect the phone to you PC with the USB cable and select 'SDK mode' from the dialogue shown by the phone. Launch the SDK Connectivity tool and tap the USB button in the application's main page. The application will then display the 'Connectivity Details' page, which contains the password required to establish the first connection with the Qt SDK (see figure 24). Note that a new password is generated every time the SDK Connectivity tool is used and valid only when the tool is running.
Figure 24: SDK Connectivity tool displaying the generated password required for the USB connection.
Leave the SDK Connectivity tool running and open the Linux phone settings (shown in figure 25) from Qt SDK (Tools -> Options -> Linux Devices tab).
Figure 25: Linux Devices settings view.
Click Add, select Device with MADDE support in the displayed dialogue and click Start Wizard. Name the configuration (see figure 26) and click Next. In most cases there's no need to change the IP address, but for trouble shooting please refer to the MeeGo 1.2 Harmattan Developer Library.
Figure 26: Enter the name for your configuration in the General Information dialogue.
Next you can set up key-based authentication of the connection between the phone and the Qt SDK. This is recommended as it frees you from needing to use password every time you connect your phone to the PC. To do this, you must first create a new key: Select No in the Device Status Check dialogue and click Next. In the Existing Keys Check dialogue, select the create new keys option. You will then be prompted for the location of the new key pair, and for a password to encrypt your private key (see figure 27).
Figure 27: Select a password to protect the private key.
Finally, proceed to the Key Deployment dialogue (see figure 28).
Figure 28: Enter the password generated by the SDK Connectivity tool into Key Deployment dialogue and click Deploy Key.
Once you have deployed the key using the password generated by the SDK Connectivity, you should see a dialogue notifying you of the successful deployment (see figure 29).
Figure 29: Key was successfully deployed.
A phone configuration test is automatically run after the setup (see figure 30).
Figure 30: The phone configuration test that is run automatically after completing setup.
You have now successfully connected your Nokia N9 to Qt SDK. Next you will use the project template to create a new Qt Quick application for Nokia N9.
Build, deploy and run the application on the phone
The steps for creating a project are similar to the ones you followed in Step 2, except that we will use Qt Quick Components for Harmattan and select the Harmattan target for the deployment (see figures 31 and 32).
Figure 31: Selecting Qt Quick Components for Harmattan.
Figure 32: Selecting the Harmattan target.
With the project created, verify that the Harmattan build and run settings are set correctly. Click Projects to open the Projects view. You should see the build settings of the Harmattan target (see figure 33). The build configuration should be Harmattan Target (Qt SDK) Release and the Qt version Harmattan Target (Qt SDK).
Figure 33: The Harmattan build settings.
The run settings (see figure 34) should have the configuration for your phone selected. In the Run Settings view you can manage the version number and the packaging information of your application.
Figure 34: The Harmattan run settings.
Click Edit to get back to the editing view. Click the hammer button to build the application.
Figure 35: A successful build.
Now you are ready to deploy the application. Click Run to package the application and install it to the phone. The Debian package containing the built application can be located in the root folder of the project.
Figure 36: The application running on the Nokia N9.
Now you have successfully deployed the application to your Nokia N9. Find out more about Qt application development by examining useful documentation, code, and learning resources

