Home · All Classes · Grouped Classes · Annotated · Functions

Tutorial: Creating a New Application

Files:

This page provides instructions for creating a new application that will run within Qtopia. The information presented here is suitable for third party users of Qtopia.

The name of the new application is MyNewApp, but a different name can be substituted. The example provided in examples/application in the Qtopia directory, will provide a base for the new application.

The instructions assume the following:

  1. Set up the environment to point to Qtopia's source directory and Qtopia's build directory. For example:
        export QTOPIA_SOURCE_PATH=$HOME/src/qtopia
        export QPEDIR=$HOME/qtopia

    (Note that these are example locations, only.) This assumes that the source directory and the build directory are in different locations; these variables might point to the same location.

  2. Create a directory for the new application (e.g. $HOME/src/mynewapp), and copy over the example files.
        mkdir $HOME/src/mynewapp
        cd $HOME/src/mynewapp
        cp -r $QTOPIA_SOURCE_PATH/examples/application/* .
        chmod +w *

    The .desktop file will be used to give application information to Qtopia, such as what icon to use to display the application in the application launcher list. The .ui file is an XML file that has been generated by Qt Designer to specify the user interface for the application. The .ts files are used for internationalization. The .pro file is used to generate a makefile for the application.

  3. Modify the filenames of the application appropriately.
        rename example mynewapp example*
        mv application.pro mynewapp.pro
        mv help/html/example.html help/html/mynewapp.html
  4. If desired, change the application's icon (pics/Example.png) to something more suitable.
  5. In mynewapp.desktop, mynewapp.h, mynewapp.cpp, main.cpp, mynewapp.pro and mynewwappbase.ui, modify all instances of "example", "Example" and "EXAMPLE" to "mynewapp", "MyNewApp" and "MYNEWAPP" respectively. In mynewapp.desktop, check that the entry for the icon is correct.
  6. In help/html/mynewapp.html, modify "Example.png" to ":image/mynewapp/Example.png" or ":image/mynewapp/<icon name>".
  7. Ensure that qmake becomes aware of the new project file:
        $QPEDIR/bin/qtopiamake
  8. Build the application:
        make install

    There should now be an executable version of mynewapp in the directory $QPEDIR/image/bin.

  9. Run Qtopia:
         $QPEDIR/bin/runqtopia

    The application MyNewApp should appear in the Applications list on the desktop display. Running the application should reveal a simple UI containing a label and a button. Help documentation is also available from the context menu.

MyNewApp can now be modified to incorporate new or existing code. Qt and Qtopia public classes can be used to facilitate this process. Qt Designer can be used to generate a new user interface file (mynewappbase.ui) for the application. Alternatively, a new user interface can be coded by hand. Help documentation should be provided by modifying help/html/mynewapp.html.

To create a completely new .pro file for the application, use the command:

    $QPEDIR/bin/qtopiamake -project

The .pro project file created can then be edited as required. To see also how to add install hints to a .pro file refer to: Install Hints.

For more information about what a .desktop file may contain, refer to: Desktop File Standard.

For information on how to improve application startup times (including the use of Quicklauncher), please refer to: Writing Applications that Start Quickly.


Copyright © 2008 Nokia Trademarks
Qtopia 4.3.3