You are on page 1of 21

F O R U M N O K I A

Getting Started with the Nokia Qt SDK

Version 1.0; April 27, 2010

Qt
Forum.Nokia.com

Copyright © 2010 Nokia Corporation. All rights reserved.


Nokia and Forum Nokia are trademarks or registered trademarks of Nokia Corporation. Java and all Java-based
marks are trademarks or registered trademarks of Sun Microsystems, Inc. Other product and company names
mentioned herein may be trademarks or trade names of their respective owners.
Disclaimer
The information in this document is provided ‘as is’, with no warranties whatsoever, including any warranty of
merchantability, fitness for any particular purpose, or any warranty otherwise arising out of any proposal,
specification, or sample. This document is provided for informational purposes only.
Nokia Corporation disclaims all liability, including liability for infringement of any proprietary rights, relating to
implementation of information presented in this document. Nokia Corporation does not warrant or represent
that such use will not infringe such rights.
Nokia Corporation retains the right to make changes to this document at any time, without notice.

Licence
A licence is hereby granted to download and print a copy of this document for personal use only. No other licence
to any other intellectual property rights is granted herein.

Getting Started with the Nokia Qt SDK 2


Forum.Nokia.com

Contents

1 Download the right tools ........................................................................................................................... 5


1.1 System requirements ..............................................................................................................................5
1.2 Download and installation ....................................................................................................................5
2 Create your first code ................................................................................................................................. 10
2.1 Import a project ..................................................................................................................................... 10
3 Test it ....................................................................................................................................................... 12
4 Deploy it on the device .............................................................................................................................. 14
4.1 Prerequisites ........................................................................................................................................... 14
4.2 Set up the Symbian device ................................................................................................................. 14
4.2.1 Install Qt 4.6.2 on the device ........................................................................................... 14
4.2.2 Install and configure the TRK debugging application on the device ................ 14
4.3 Set up Qt Creator.................................................................................................................................... 16
4.4 Build the application for GCCE Debug build .................................................................................. 17
4.5 Deploy and run the application on the device ............................................................................ 17
4.6 Optimise the code for a mobile device .......................................................................................... 18
5 Where to go next ........................................................................................................................................ 20
5.1 Examine the Qt Creator and Qt Simulator features .................................................................... 20
5.2 Learn Qt .................................................................................................................................................... 20
5.3 Learn how to use Qt on mobile ........................................................................................................ 20
5.4 Use Qt Reference Documentation to find information on available APIs........................... 20
5.5 Examine code examples...................................................................................................................... 20
5.6 Use mobile features.............................................................................................................................. 20
5.7 Expand with platform features......................................................................................................... 21

Getting Started with the Nokia Qt SDK 3


Forum.Nokia.com

Change history

April 27, 2010 Version 1.0 Initial document release

Getting Started with the Nokia Qt SDK 4


Forum.Nokia.com

1 Download the right tools


The Nokia Qt SDK is an easy-to-install and use development environment for Qt application developers
targeting mobile platforms such as Symbian and Maemo™. There is only one installation file to
download. The Nokia Qt SDK Setup wizard will guide you through the installation process.

Note: The Nokia N900 mobile computer will support applications created with this beta in the
forthcoming version 10.2010.09-3 firmware update.

1.1 System requirements

The following operating systems are supported:


• Windows XP Service Pack 2 / Windows Vista / Windows 7
• (K)Ubuntu Linux 7.04 32 bit and 64 bit with the following required components:

g++ Make libglib2.0-dev


libSM-dev libxrender-dev libfontconfig1-dev
libxext-dev libfreetype6-dev libx11-dev
libxcursor-dev libxfixes-dev libxft-dev
libxi-dev libxrandr-dev libgl-dev and libglu-dev (if using QtOpenGL)

You need approximately 4 GB of free disk space for the installation.

1.2 Download and installation

To download the Nokia Qt SDK, go to the Nokia Qt SDK Beta web page
(http://www.forum.nokia.com/info/sw.nokia.com/id/e920da1a-5b18-42df-82c3-
907413e525fb/Nokia_Qt_SDK.html).

Each installer is available in offline and online versions. The offline installer includes the entire Nokia
Qt SDK, while the online version downloads the software when run on your computer. If you
encounter problems with the online installer in a corporate network, use the offline installer instead.

Getting Started with the Nokia Qt SDK 5


Forum.Nokia.com

Figure 1: The download page provides offline and online installers for Windows and Linux.

Locate the installer executable file on your computer and run it.

Figure 2: The setup wizard opens. Note that this may take a while on slower PCs.

Getting Started with the Nokia Qt SDK 6


Forum.Nokia.com

Figure 3: Accept the licence agreement.

Figure 4: Select the installation directory.

Getting Started with the Nokia Qt SDK 7


Forum.Nokia.com

Figure 5: Select where in the Startup menu the SDK shortcuts are placed.

Figure 6: You can follow the download/installation of each component.

Once the installation is complete, you are prompted to launch Qt Creator and the Symbian and Maemo
development tutorials that describe how to configure debug and deployment environments. However,
we do not need them at this point. You can find them later in the \Symbian\readme and
\Maemo\readme directories under the SDK installation directory.

Getting Started with the Nokia Qt SDK 8


Forum.Nokia.com

Figure 7: Installation is complete. Click Finish to launch the QtCreator IDE.

Figure 8: Qt Creator has been successfully launched.

At this point no further configuration is needed because you do not configure the Nokia Qt SDK with
any existing Symbian S60 or Maemo SDKs.

Getting Started with the Nokia Qt SDK 9


Forum.Nokia.com

2 Create your first code

2.1 Import a project

Qt Creator opens in a Welcome view. Test that your installation is successful by opening an existing
example application project.

Figure 9: Expand the Choose an example… drop-down list and select Animated Tiles.

Figure 10: Select the desired targets.

Select at least Qt Simulator and one of the mobile targets, Maemo or Symbian Device, depending on
the device you are using.

Getting Started with the Nokia Qt SDK 10


Forum.Nokia.com

Note: If you want to add targets later, this is possible from the Projects view, which you can open
from the left-hand toolbar.

Figure 11: The project opens. Click on any of the source or header files to view and edit the code.

Click the Build button in the bottom left-hand toolbar (shown in Figure 12). The Build progress bar in
the toolbar becomes green once the project has been successfully built. If you want to see the
compilation progress, open the Compile Output log.

Figure 12: Target, Run, Debug, and Build buttons in the left-hand toolbar and Compile Output log are shown.

Getting Started with the Nokia Qt SDK 11


Forum.Nokia.com

3 Test it
Next, run the application in the simulator. Click the device icon in the left-hand toolbar to select the
target. A pop-up menu opens (see Figure 13). Click Qt Simulator as a target (the active target has a
blue background colour). If you have multiple projects open in Qt Creator, make sure the correct
project is active. You can change it from the Project bar of the pop-up menu.

Figure 13: The target selection menu appears.

Click the green Run button (see Figure 12).

You can see the application in the simulator (see Figure 14).

Getting Started with the Nokia Qt SDK 12


Forum.Nokia.com

Figure 14: The application is running in Qt Simulator with the Symbian Touch configuration.

Note: The Symbian and Maemo platform macros are not supported by the simulator. This means
that, for example, screen size settings made for Symbian and Maemo targets do not apply in the
simulator. Also, the Symbian or Maemo menu or Exit controls do not currently work in the simulator.

Next to the simulator there is a specific view for changing settings. Under the View tab you can, for
example, toggle the orientation (Rotate Device), or choose from the various Symbian and Maemo
configurations (Device). You can also simulate various mobile functions and even create your own
scripts. For more information on the simulator features, see Qt Creator Help.

Now you have successfully run your application on Qt Simulator. Let’s test it on a real device.

Getting Started with the Nokia Qt SDK 13


Forum.Nokia.com

4 Deploy it on the device


This section describes building the application for the Symbian GCCE target and deploying the
application on the device. Building for GCCE itself can be done without additional installations, but to
conveniently deploy and debug the application on the device, Qt 4.6.2 libraries and a debugging
application must be installed on the device. The latter also requires some configuration in Qt Creator.

Follow this documentation carefully, step by step (especially to first set up the device and then the
host PC).

Note: If you wish to debug the application on a Nokia N900 device, follow the instructions provided
by the SDK (for example, in Windows OS, check <NokiaQtSDK installation
folder>\Maemo\readme). Note, however, that full support for the Nokia N900 device is expected
to be available only in the forthcoming version 10.2010.09-3 firmware update.

4.1 Prerequisites
Debugging is only supported in Windows OS (32 bit and 64 bit supported). Additionally, you need:
• A Symbian device with a USB connect cable (to fully run the example application, an S60 5th
Edition Touch UI device is needed)
• Nokia Qt SDK
• Ovi Suite or Nokia PC Suite

4.2 Set up the Symbian device

Connect the Symbian device to the PC using the USB cable delivered with your device. Select PC Suite
mode. If you haven’t previously used the device with Ovi Suite or PC Suite, all the needed drivers are
first installed automatically. This takes approximately one minute.

4.2.1 Install Qt 4.6.2 on the device

For this you need a programme that can install .sis files (Ovi Suite or Nokia PC Suite). To install Qt,
use the shortcut that Nokia Qt SDK has created in the Start menu (StartMenu > Nokia Qt SDK >
Symbian > Install Qt to Symbian device) and follow the steps on your screen.

Alternatively, you can find the Qt installation package using Windows Explorer. Navigate to
<NokiaQtSDK_install_path>\Symbian\sis and select qt_installer.sis.

Note: In some combinations, Ovi Suite has problems installing .sis files. However, you can copy the
file (<NokiaQtSDK_install_path>\Symbian\sis) to the device in USB storage mode or send
the file via Bluetooth and install it with the help of the device file browser.

4.2.2 Install and configure the TRK debugging application on the device

Use the shortcut in the Start Menu to install the TRK application (StartMenu > Nokia Qt SDK -Beta
release > Symbian > Install TRK to Symbian device).

Alternatively, you can navigate to <NokiaQtSDK_install_path>\Symbian\sis and select


s60_5_0_app_trk_3_1_2.sisx.

Once the installation is complete, navigate to the folder where all the installed applications go on your
Symbian device (Applications, Install, etc.) and start the TRK application.

Getting Started with the Nokia Qt SDK 14


Forum.Nokia.com

Figure 15: TRK application on the Symbian device

Figure 16: The TRK application is now open but not yet connected.

Choose ‘No’ at the Bluetooth connection prompt. Then open Options | Settings and change the
connection type to USB (see Figure 17).

Figure 17: Open Options | Connect and change the connection type to USB.

Getting Started with the Nokia Qt SDK 15


Forum.Nokia.com

Figure 18: The TRK application is now connected to the PC.

The Symbian device is now configured (see Figure 18).

4.3 Set up Qt Creator

In Qt Creator, go to the Projects view from the left-hand toolbar. Then go to the Symbian Device |
Build tab (see Figure 19).

Figure 19: The Symbian Device Build Settings view is opened.

Note: If you did not add a Symbian target in the project import/creation phase, this tab is not
visible. However, you can add it now by pressing ‘+’ and selecting Symbian from the drop-down list.

Make sure that you have Debug selected in the Edit Build Configuration drop-down menu.

The Qt version should be Qt for Symbian Devices (Qt SDK pre-beta). If it is not, you can change it by
clicking Manage.

Now go to the Symbian Device | Run tab (see Figure 20). Make sure that your active project is in the
Run configuration, in this case ‘animatedtiles on Symbian device’.

Also check that the Device on Serial Port field shows information on your device model and the COM
port.

Getting Started with the Nokia Qt SDK 16


Forum.Nokia.com

Figure 20: The Symbian Device Run Settings view is opened.

All the needed configurations are now done.

4.4 Build the application for GCCE Debug build

Select Symbian Device as a target in the left-hand toolbar (shown in Figure 21). Make sure that you
have selected Debug build and the correct project is active (in this case, ‘animatedtiles on Symbian
Device’).

Figure 21: The Symbian Device Debug build is selected. Compile Output shows a successful build.

You can follow the build progress from the Compile Output tab and also see that a self-signed .sis
installation file has automatically been created.

Note: You can create the Release build of the application in a similar fashion.

4.5 Deploy and run the application on the device

You are ready to deploy and run the application on the device. Click the green Run button.

Optional: To add breakpoints and examine the code line by line, click the Debug button instead. See
Qt Creator Help for more information on how to add breakpoints in Qt Creator.

Getting Started with the Nokia Qt SDK 17


Forum.Nokia.com

Figure 22: The debug build of the application is running.

From the Application Output you can see that the installation file has been deployed and installed on
the device, and the application has started.

Figure 23: The application in its original screen size is running on the device.

4.6 Optimise the code for a mobile device

You can see that the application is not scaling to the whole screen (Figure 23).

To fix this, go to the Edit view in Qt Creator and open the main.cpp file. On line 214 you will see that
the application is defined to take the window size (which works nicely in the desktop builds):

view->show();

Getting Started with the Nokia Qt SDK 18


Forum.Nokia.com

In Symbian and Maemo, a better choice is to use showMaximize(). This scales the application to fit
the entire application area while still keeping the status and control panes.

Change the line as follows:

view->showMaximized();

Now repeat the steps described in Section 4.4 and Section 4.5 to build and run (you can directly click
the Run button if you are sure about the changes you have made).

Congratulations — you now have a fully scalable application running on your Symbian device (shown
in Figure 24).

Figure 24: A fully scalable application is now running on the device.

Note: Should you need the animatedtiles.sis installation package later, it can be found in the
<NokiaQtSDK_install_path >\Examples\animation\animatedtiles directory.

Getting Started with the Nokia Qt SDK 19


Forum.Nokia.com

5 Where to go next
Now you have successfully created your first project in the Nokia Qt SDK and tested it in the Qt
Simulator as well as on a Symbian device. You can now continue with the following steps:

5.1 Examine the Qt Creator and Qt Simulator features

Even if you were familiar with the Qt Creator IDE, we advise you to open Help in Qt Creator and
navigate to Qt Creator. It provides a comprehensive manual on how to create and manage projects to
create C++ and QtQuick applications, and on how to use Qt Designer to create UIs easily.

Also learn how to use the advanced simulation features of the Qt Simulator (Help | Qt Simulator).

5.2 Learn Qt

We assume that you already know C++ and will be using it for Qt development. However, if you are
new to Qt-specific idioms, coding conventions, and key concepts, we recommend you to go to Help | Qt
Reference Documentation | How to learn Qt.

5.3 Learn how to use Qt on mobile

Forum Nokia offers various self-learning resources from training courses to e-learning modules and
how-to videos:
http://www.forum.nokia.com/Learning_and_Events/Training/Training_Courses.xhtml
http://www.forum.nokia.com/Learning_and_Events/E-learning.xhtml
http://www.forum.nokia.com/document/Mobile_Hands-on_Labs/
http://www.forum.nokia.com/info/sw.nokia.com/id/47ec8244-c717-45e9-84ed-
ee4a39f2a397/Simple_Qt_Animation_Example.html

5.4 Use Qt Reference Documentation to find information on available APIs

When you are ready to start developing an application, API documentation is available for you in the
Qt Creator. Go to Help | Qt Reference Documentation for the comprehensive documentation,
including tutorials and example applications.

5.5 Examine code examples

Have a look at example applications to see how Qt can be used in applications. A full set of Qt cross-
platform examples is available in the <NokiaQtSDK_install_path >\Examples directory. In
addition, a selection of advanced, mobile-optimised example applications is available for download at
Forum Nokia Qt Code Examples
(http://www.forum.nokia.com/Tools_Docs_and_Code/Code_Examples/Qt.xhtml). All example
applications come with a full source that you can examine and utilise in your own applications.

5.6 Use mobile features

The first set of Qt Mobility API provides a set of interfaces to enable mobile use cases such as
Messaging, Contacts, and Location. The API is already partially in the Nokia Qt SDK and is expected to
evolve in the near future to also provide full support for Maemo. Additional APIs are also in the works.
For an overview of the Mobility API, read the Qt Mobility White Paper (http://qt.nokia.com/files/pdf/qt-

Getting Started with the Nokia Qt SDK 20


Forum.Nokia.com

mobility-whitepaper-1.0.0), and for in-depth API documentation go to Help | Qt Mobility Project


Reference Documentation in Qt Creator.

5.7 Expand with platform features

Even though the Nokia Qt SDK provides a comprehensive development environment for applications
targeted at Symbian and Maemo platforms, in some applications there may still be a need for
additional platform features that are not part of Qt or the Qt Mobility API. In those cases you still have
an option to download and use S60 and Maemo SDKs. They can also be used with the Qt Creator.
Alternatively, to fully utilise advanced features (such as running the application in the device emulator,
scanning for Symbian capabilities, or using advanced Maemo debian packaging methods) provided by
native toolchains, you can use IDEs such as the Eclipse-based Carbide.c++ for Symbian or EsBox for
Maemo development. Read more about the platform-specific tools in the Forum Nokia Qt web page
(http://www.forum.nokia.com/Technology_Topics/Development_Platforms/Qt/).

Getting Started with the Nokia Qt SDK 21

You might also like