Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

Tutorial: Creating a New Application

Files:

Introduction

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

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

Prerequisites

The instructions assume the following:

Important Files for New Applications

When creating a new Qt Extended application the following files are of particular importance

File NameDescription
qbuild.proThe qbuild.pro file is used to describe how the application is to be built. For hints on what content be added see the example application's qbuild.pro; see also Project Files
.desktopEach application will have a .desktop file to give application information to Qt Extended, such as what icon to use to display the application in the application launcher list, see also Desktop File Standard
.uiSome applications will have .ui files that has been generated by Qt Designer to specify the user interface for the application, see Qt Designer Manual
.tsSome applications will have .ts files to support Internationalization, see also Internationalization

Suggested Steps in Creating New Application From Example Application

  1. Set up the environment to point to the Qt Extended source directory and the Qt Extended build directory. For example:
        export QTOPIA_SOURCE_PATH=$HOME/src/qt-extended-<version>
        export QPEDIR=$HOME/build/qt-extended-<version>-qvfb

    (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, for example:
        mkdir $HOME/src/mynewapp
        cd $HOME/src/mynewapp
        cp -r $QTOPIA_SOURCE_PATH/examples/application/* .
        chmod +w *
  3. Modify the filenames of the application appropriately using the rename and mv commands, for example:
        rename example mynewapp example*
        mv help/html/example.html help/html/mynewapp.html
        mv pics/Example.png pics/MyNewApp.png
  4. If desired, use a program like gimp to change the application's icon pics/MyNewApp.png to something more suitable.
  5. Modify all instances of "example", "Example" and "EXAMPLE" to "mynewapp", "MyNewApp" and "MYNEWAPP" respectively in the files:
  6. In mynewapp.desktop, check that the entry for "Icon" suits the application icon's name, eg "mynewapp/MyNewApp".
  7. In help/html/mynewapp.html, check that "img" node has a "src" attribute that suits the applications icon, eg ":image/mynewapp/MyNewApp".
  8. Ensure that qbuild becomes aware of the new project file:
  9. Build the application:
        $QPEDIR/bin/qbuild       # build source files
        $QPEDIR/bin/qbuild image # install the created application into image

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

  10. Run Qt Extended:
         $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 Qt Extended 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.

Creating a New qbuild.pro for Existing Application

To generate a completely new qbuild.pro file with the files found in the current directory, use the command:

    $QPEDIR/bin/qbuild -project

then edit the qbuild.pro project as required. See also Create a new project file.

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


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3