Creating a Mobile Application with Nokia Qt SDKNote: To complete this tutorial, you must install Nokia Qt SDK. The installation program installs and configures the necessary tool chains for mobile application development. This tutorial describes how to use Qt Creator to create a small Qt application, Battery Indicator, that uses the System Information Mobility API to fetch battery information from the device. Note: Create the project with the Help mode active so that you can follow these instructions while you work. The Introduction and Project Location dialog opens. The Select Required Qt Versions dialog opens. Note: Targets are listed if you installed the appropriate development environment, for example, as part of the Nokia Qt SDK. The Class Information dialog opens. Note: The Header File, Source File and Form File fields are automatically updated to match the name of the class. The Project Management dialog opens. The BatteryIndicator project now contains the following files: The files come with the necessary boiler plate code that you must modify, as described in the following sections. You do not need to change the main.cpp file. The New wizard automatically adds information to the .pro file that you need when you use the Qt Mobility APIs or develop applications for Symbian devices. You must modify the information to declare the Qt Mobility APIs that you use. This example uses the System Info API, so you must declare it, as illustrated by the following code snippet: Each Mobility API has its corresponding value that you have to add as a value of MOBILITY to use the API. For a list of the APIs and the corresponding values that you can assign to MOBILITY, see the Quickstart Example. The following code snippet shows information that is needed for applications developed for Symbian device. Qt Creator generated the UID for testing the application on a device. You only need to change the UID and capabilities if you deliver the application for public use and need to have it Symbian Signed. The batteryindicator.h file contains some of the necessary #includes, a constructor, a destructor, and the Ui object. You must include the System Info header file, add a shortcut to the mobility name space, and add a private function to update the battery level value in the indicator when the battery power level changes. Now that the header file is complete, move on to the source file, batteryindicator.cpp. Now that you have all the necessary code, select Qt Simulator as the target and click the button to build your program and run it in the Qt Simulator. In Qt Simulator, run the runOutOfBattery.qs example script to see the value change in the Battery Indicator application. Select Scripting > examples > runOutOfBattery.qs > Run. You also need to test the application on real devices. Before you can start testing on Symbian devices, you must connect them to the development PC by using an USB cable and install the necessary software on them. The Maemo emulator emulates the Nokia N900 device environment. You can test applications in conditions practically identical to running the application on a Nokia N900 device with the software update release 1.2 (V10.2010.19-1). For more information, see Using the Maemo Emulator.
X
|