Qt Extended Home · Build System Home · Reference · User Guide · Internals codeless banner


Qt Extended applications can be built in one of four ways.

To facilitate switching between build modes, two macros are provided. They are to be used as follows (from examples/application/main.cpp):

    #include "example.h"
    #include <qtopiaapplication.h>


The first argument to QTOPIA_ADD_APPLICATION() must be a literal string that matches the binary name (ie. the value of TARGET from the qbuild.pro file). The build system defines QTOPIA_TARGET with the value of TARGET and it is recommended to use this macro. The second argument to QTOPIA_ADD_APPLICATION() should be the name of your class. If you use the wrong value you will get a compile failure.

Some applications cannot use the macros (eg. If you need to use a custom application class). This prevents the use of quicklauncher but you can still work with singleexec if you make some changes to your code. You need to have a main.cpp that looks something like this (from examples/manual_main/main.cpp):

    #include "example.h"
    #include <qtopiaapplication.h>

    #ifdef SINGLE_EXEC
    #define MAIN_FUNC main_exampleapp
    #define MAIN_FUNC main

    // This is the storage for the SXE key that uniquely identified this applicaiton.
    // make will fail without this!

    int MAIN_FUNC( int argc, char **argv )
        // This is required to load the SXE key into memory

        QtopiaApplication a( argc, argv );

        // Set the preferred document system connection type

        Example *mw = new Example();
        if ( mw->metaObject()->indexOfSlot("setDocument(QString)") != -1 ) {
        } else {
        int rv = a.exec();
        delete mw;
        return rv;

Note that the second argument to QTOPIA_ADD_APPLICATION() is appended to main_ so that the main function has a unique name.

Note that packages cannot contain quicklaunched applications. See Package Limitations for more informtation.

The project must declare what build styles it supports. It does this via the quicklaunch and singleexec CONFIG values. The following table illustrates.

Singleexec build?quicklaunchsingleexecresult
nononoregular application
noyesnoquicklaunch application
yesnonoregular application (avoid using Qt and other Qtopia libs as they will be statically linked)
yesnoyessingleexec application (main function mechanism)
yesyesyessingleexec application (quicklaunch mechanism)

See also Overviews, quicklaunch, singleexec, QTOPIA_TARGET, QTOPIA_ADD_APPLICATION(), QSXE_APP_KEY, QTOPIA_SET_DOCUMENT_SYSTEM_CONNECTION(), Quicklauncher, Qt Extended Single Exec, and Project Files.

Copyright © 2009 Trolltech
Qt Extended - Build System Documentation