Qt Quick Start
From Symbian Developer Community
| Getting Started with Qt > Qt in a Nutshell > Qt Technical Overview > Qt Quick Start | |
This Nokia Qt SDK is suitable if you want to write pure Qt applications. See Using Qt with Standalone SDKs if you need to write code that mixes Qt and Symbian C++.
Contents |
SDK Installation
The Nokia Qt SDK will work on a computer with:
- Windows XP Service Pack 2, Windows Vista or Windows 7
- 4 GB of free disk space.
Download and run the online installer:
The installer will ask where the SDK should be installed and which components are required. The SDK may be installed to any location, and you can install all components (you may omit the Maemo toolchain for a faster installation).
The Windows development environment is now fully configured an ready for use!
Set up the mobile device
In order to run and debug applications on the device you need to install the Qt binaries and the TRK debug stub.
First install Ovi Suite or Nokia PC Suite and connect your device. This will allow you to copy the needed files by selecting them in the start menu or from Windows Explorer. If the PC suite fails to install the SIS files for any reason you can manually copy them to the device from C:\NokiaQtSDK\Symbian\sis using USB storage mode, and then install them by selecting them in the device file browser.
Deploy Qt
Select all the Windows start menu shortcuts to install the Qt binaries:
- StartMenu | Nokia Qt SDK | Symbian
- Install Qt to Symbian device
- Install QtMobility to Symbian device
- Install SQLite to Symbian device
You may also wish to install the Qt "fluidlauncher" demonstration applications: C:\NokiaQtSDK\Symbian\sis\qt_demos.sis.
If deploying Qt to a Samsung phone ...Deploy and configure TRK
TRK is an on-device debug stub that Qt Creator uses to copy applications onto the device and then run or debug them. TRK needs to be installed on the device, and started before every debug session.There are several different versions of TRK. Select the version most appropriate for your device from the Windows start menu:
- StartMenu | Nokia Qt SDK | Symbian | Install TRK to Symbian device
- TRK S60 3rd Edition, Feature Pack 1
- TRK S60 3rd Edition, Feature Pack 2
- TRK S60 5th Edition (use this one for Symbian platform devices!)
From your device "Applications" folder, select the TRK icon. Then change the settings to USB via the menu: Options | Settings | Connection | USB. These setting are saved, and will be used next time you use the TRK.
When the status changes to "Connected" in the TRK console (as shown below), applications can be run and debugged on the device.
That's it - you're development environment is now fully configured!
Working with Qt Creator
Qt Creator, the preferred IDE for Qt development, is included in the Nokia Qt SDK. It contains the Qt documentation set and has wizards for creating a basic mobile application. This section covers basic tasks like creating and opening a project, through to building and deploying the project on a device.
Qt Creator is started through the windows start bar: StartMenu | Nokia Qt SDK | Qt Creator
Creating a project
To create a new application select the menu: File | New File or Project.
Then select the Mobile Qt Application project type (in the Qt C++ Project section) as shown below. This wizard creates an application which already implements the minimum required changes for a Qt application on Symbian - for example, setting the application window to fill the screen.
On the Next page of the wizard ("Introduction and project location") specify the project name, in this case HelloWorldQtCreatorMobile, and the location where the project should be created. Note that the project must:
- be on the same drive as the SDK
- not contain spaces or other special characters.
On the Next page of the wizard ("Set up targets for your project") select both Simulator and Device targets.
On the Next page of the wizard ("Class information") specify the name of our main window class, its base class, the names of the files, and whether a Qt Designer UI form should be created. For this tutorial, we specify the class name of HelloMainWindow and accept the sensible default values generated by the wizard.
On the Next page of the wizard ("Project management") specify version control and other project information. In this case we're not using any so just view the files that are going to be created.
Press Finish to create the project.
That is all you need to do to create a framework for your application that you can build and run. The application simply displays an empty window, which isn't very interesting for our users. In the spirit of "HelloWorld" applications everywhere, interested users can expand the toggle below to find out how to add a menu option and display a "HelloWorld" dialog when it is selected.
How to add a menu ...Opening a project
If you want to open the standard Qt Examples, you can do so directly by selecting Qt Creator's Welcome sidebar button, and then choosing the example from the section "Explore Qt Examples". To open any other application:
- Go to the menu File | Open File or Project
- Navigate to the application's directory and selecting its project file (.pro).
The "Setup targets" dialog will then be displayed, as shown in the image below.
Select the Simulator and device entries for the Nokia Qt SDK (if you have other Qt SDKs installed, entries will also appear for these targets). When you select Finish the project will open within the IDE.
Projects written for the desktop or other platforms will probably need at least a few changes to run effectively on the Symbian platform (this true for some of the standard Qt Examples and demonstration applications). The required changes are discussed in Qt Applications for Symbian Devices.
Next, build and run the application.
Building and running the application
The Nokia Qt SDK installs Qt Creator pre-configured to build and run applications on the Windows hosted Simulator or Symbian platform device. The only configuration needed should have already been done - installing Qt and TRK and connecting the mobile device to the PC.
The build/run actions are at the bottom of the left sidebar as shown below. The first button shows the current build target: Simulator or Device. A different icon is shown for the different build targets, and to indicate whether or not a device is connected. In this case we see that we're connected to a mobile device and planning to build debug binaries.
The "build target" button may be selected to change the build target (device or Simulator targets, release or debug):
The remaining buttons (from top to bottom), run, debug or just build the currently selected target.
To build and run for a particular target, select that target and then one of the Run, Debug or Build buttons. If the build is successful, the last message from the Compile Output tab will be: Exited with code 0.
Qt Simulator target
The Qt Simulator is no replacement for testing on the device!
The Simulator builds binaries for the host operating system (Windows in this case) and skins them with a device look and feel. What this means is that while the Simulator may look like a device, the underlying behaviour will that of the host operating system. It won't have the same usage of network stack, platform security, anything that uses the platform specific #define, etc. It is however useful for testing because it can simulate results that might otherwise be difficult or expensive to collect - e.g. incoming SMS messages, location information.
Note that at time of writing it also appears to be unresponsive to the left and right softkeys.
Symbian device target
Symbian platform C++ applications must be digitally signed prior to installation on a device.
When targeting a device Qt Creator will create an application that is suitable for testing. It will automatically self-sign the application installation file (.SIS) with a local certificate, copy and install it to the device, and then run it. The SIS file contains only the application itself, not the Qt binaries (which must have been pre-installed on the device).
Documentation
All the documentation for the SDK is available from within the Qt Creator by selecting "Hello" ("?" icon) on the sidebar. This contains almost everything you need to know about using Qt and the toolchain (including the Simulator). The information on using Qt with Symbian is relatively limited, and not very visible. the Developing a Qt Application (Trail) is a good starting point for finding out about Symbian-specific Qt development.
Command line
The command line can be used to build and package applications for the device.
Open the command prompt provided in the Windows start button: StartMenu | Nokia Qt SDK - beta release | Symbian | Qt for Symbian Command Prompt; This command prompt has been configured with the correct paths and environment variables to build against the Nokia Qt SDK.
Navigate to your target project. A good example for testing is the animatedtiles example code that comes with the Qt installation: C:\NokiaQtSDK\Examples\4.6\animation\animatedtiles.
To build the application, use the command line as shown (and then described) below:
qmake
make release-gcce
make sis
- Run qmake to generate the Symbian specific bld.inf, .mmp, .rss and .pkg files
- Build for the device using make debug-gcce or make release-gcce to build debug/release binaries.
- Call make sis to create an unsigned installation file that can be installed and run on devices where Qt has already been deployed.
The installation file contains only the application itself, not the Qt binaries. To create a wrapper SIS file that includes the application SIS and a "Smart installer" (which will download the binaries on the device if they are needed) next call make installer_sis:
qmake
make release-gcce
make sis
make installer_sis
Troubleshooting
Most users should have followed the instructions and built an example without difficulty. If you do encounter development or installer issues then you should check:
- Qt Known Issues (4.6.3) on Gitorious
- Qt FAQ on Gitorious
- Qt Installer bugs on Qt Bug tracker
- Qt Creator bugs on Qt Bug tracker
- Qt Simulator bugs on Qt Bug tracker
- Qt Q&As
Summary
This tutorial demonstrated how to set up a Qt development environment on a windows computer and a Symbian mobile device. It then showed how to create a simple "Hello World" application and then run it on a device or the Simulator.
Next steps
- To understand the aspects of Qt development that are specific to the Symbian platform, follow the trail: Developing a Qt Application (Trail). This leads you through a discussion of the main platform specific issues you need to think about when developing for Qt on Symbian, including Symbian's platform security model, application signing, and how to package an application for distribution.
- To learn "generic" Qt, see How to learn Qt in the Qt reference documentation. The Qt for Symbian Blog also has some useful getting started guidance.
Related information
- Nokia Qt SDK
- Qt Reference Documentation (recommended)
- Qt Developer's Library (Forum Nokia)
- Qt on Samsung Symbian Part 1 and Part 2
- A Video Guide for Setting up Qt development environment for Symbian
- Getting Started with the Nokia Qt SDK - Forum Nokia whitepaper
| Getting Started with Qt > Qt in a Nutshell > Qt Technical Overview > Qt Quick Start | |
Comments
Sign in to comment…










