Skip to content
Snippets Groups Projects
qtcreator.qdoc 252 KiB
Newer Older
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

    To add a Qt version:
    \list 1
        \o Select \gui{Qt Creator} > \gui Preferences... > \gui{Qt Versions}.
        \o Click \inlineimage qtcreator-macosx-add.png
           and enter the name of the version in \gui{Version Name}.
        \o Enter the path to the qmake binary in \gui{Path to qmake}.

           \image qtcreator-qt4-qtversions.png
    \endlist

    \section1 Adding External Libraries to a qmake Project

    Through external libraries Qt Creator can support code completion and
    syntax highlighting as if they were part of the current project or the Qt
    library.

    To add an external library:
    \list 1
        \o Open your project file (.pro) using the \gui Projects pane.
        \o Follow the instructions at \l{http://doc.qt.nokia.com/4.7-snapshot/qmake-project-files.html#declaring-other-libraries}
           {Declaring other Libraries}.
    \endlist

    Syntax completion and highlighting work once your project successfully
    builds and links against the external library.

Leena Miettinen's avatar
Leena Miettinen committed
*/


/*!
    \contentspage index.html
    \previouspage quick-application-logic.html
Leena Miettinen's avatar
Leena Miettinen committed
    \page creator-building-running.html
Leena Miettinen's avatar
Leena Miettinen committed

    \title Building and Running Applications

    Qt Creator provides support for building and running Qt applications for
    desktop environment and mobile devices. When you install the Nokia Qt SDK,
    the build and run settings for the Maemo and Symbian targets are
Leena Miettinen's avatar
Leena Miettinen committed
    set up automatically.

    You can add a target if the necessary tool chain is installed on the
    development PC and the Qt version is configured. Click
    \inlineimage qtcreator-qt4-addbutton.png "Add Target button"
    and select from a list of available
    targets. To remove a target, select it and click
    \inlineimage qtcreator-target-remove.png "Remove Target button"
    .

Leena Miettinen's avatar
Leena Miettinen committed
    You can select the targets and click the \gui Run button to build and
    run the applications on the targets. You can click the \gui {Build All}
    button to build all open projects, one after another.
Leena Miettinen's avatar
Leena Miettinen committed
     \section1 Setting Up a Project
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

    To view and modify the settings for currently open projects, switch to the
Leena Miettinen's avatar
Leena Miettinen committed
    \gui Projects mode by pressing \key Ctrl+5.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

    \image qtcreator-projectpane.png

    The project pane consists of the following tabs:
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \list
       \o \l{Building for Multiple Targets}{Targets}
       \note If you have installed only one tool chain, the \gui Targets
       tab is replaced by a \gui {Build and Run} tab.
       \o \l{Specifying Editor Settings}{Editor Settings}
       \o \l{Specifying Dependencies}{Dependencies}
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \endlist

Leena Miettinen's avatar
Leena Miettinen committed
    Use the \gui Build and \gui Run buttons to switch between
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    the build and run settings for the active project.

    If you have multiple projects open in Qt Creator, use
    \gui{Select a Project} option at the top to navigate between different
    project edits.

*/


/*!
    \contentspage index.html
    \previouspage creator-building-running.html
    \page creator-building-targets.html
    \nextpage creator-build-settings.html

    \title Building for Multiple Targets
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

    Different build configurations allow you to quickly switch between
    different build settings. By default, Qt Creator creates \bold debug
Leena Miettinen's avatar
Leena Miettinen committed
    and \bold release build configurations.

Leena Miettinen's avatar
Leena Miettinen committed

    \list 1

        \o Select \gui Desktop as the target.

        \o Click the \gui Run button.

    \endlist

Leena Miettinen's avatar
Leena Miettinen committed

    You can use the Qt Simulator to test Qt applications that are intended
    for mobile devices in an environment similar to that of the device. You
    can change the information that the device has about its configuration
    and environment.

    \list 1

        \o Select \gui {Qt Simulator} as the target.

        \o Click the \gui Run button.

    \endlist

    For more information about using the Qt Simulator, see the
    \l{http://doc.qt.nokia.com/qt-simulator-beta/index.html}{Qt Simulator Manual}.

    \section1 Building for Maemo
Leena Miettinen's avatar
Leena Miettinen committed

    \list 1

        \o Build and run the application for \l{Building for Qt Simulator}{Qt Simulator}.

        \o Build and run the application for \l{Using the Maemo Emulator}{Maemo Emulator}.

        \o Alternatively, you can build and run the application for a device:
Leena Miettinen's avatar
Leena Miettinen committed
        \o Set up the MADDE development environment and specify a connection
        to the device. For more information, see
        \l{Setting Up Development Environment for Maemo}.

        \o Connect the device to the development PC.

        \o Click the \gui Run button.

Leena Miettinen's avatar
Leena Miettinen committed
        Qt Creator uses the compiler specified in the MADDE toolchain to
        build the application.

        Qt Creator generates an installation package, installs in on the device,
        and executes it. The application views are displayed on the Nokia N900.
        Command-line
        output is visible in the Qt Creator \gui {Application Output} view.
Leena Miettinen's avatar
Leena Miettinen committed

        Debugging also works transparently.

        \section2 Creating Installation Packages

        When you build the application for the \gui{Maemo} target, Qt
        Creator automatically generates a debian installation package
        in the project folder. You can deliver the installation package to
        users for installation on Maemo devices.

        You can add other files to the installation package in the
        \gui {Create package} step in the build configuration. Add files
        to the \gui {Package contents} field. In \gui {Local File Path},
        specify the location of the file on the development PC. In
        \gui {Remote File Path}, specify the folder to install the file on
        the device.

        \image qtcreator-maemo-deb-package.png "Create installation package"

Leena Miettinen's avatar
Leena Miettinen committed

Leena Miettinen's avatar
Leena Miettinen committed

    \list 1

        \o Build and run the application for \l{Building for Qt Simulator}{Qt Simulator}.

        \o If no problems are found, build and run the application for a device.

        \o To test functionality that uses Symbian APIs, you can build and
        run the application for Symbian Emulator.

    \endlist

    The build configuration for the \gui{Symbian Device} target
    uses the GCCE tool chain by default. If you want to build
    for the device using RVCT, select it in the \gui {Tool chain} field
    in the \gui{General} section.

    \section2 Building and Running for a Device
Leena Miettinen's avatar
Leena Miettinen committed

    \list 1

        \o Install the required software on the device. For more information, see
        \l{Setting Up Development Environment for Symbian}.

        \o Connect the device to the development PC through a USB cable.
        The target selector displays a green check mark when a
        device is connected.
Leena Miettinen's avatar
Leena Miettinen committed

        \image qtcreator-qt4-symbian-device-connected.png

        The tool tip of the target selector shows more details about the actual
Leena Miettinen's avatar
Leena Miettinen committed
        device that will be used when you run your application.

        \o Start the \gui{App TRK} application on your device.

        \o Click the \gui Run button.

    \endlist

    You can connect several devices to your development PC simultaneously.
    In the details of the run configuration for the \gui{Symbian Device} target,
    select the device to run your application on.

    \section3 Creating Installation Packages

    When you build the application for the \gui{Symbian Device} target, Qt
    Creator automatically generates a Symbian installation system (SIS) file
    in the project folder. You can deliver the installation file to users for
    installation on Symbian devices.

    Only installation files signed with a certificate and private key are
    allowed to be installed onto Symbian devices. By default, Qt Creator
    self-signs the installation file. This self-signing allows you to install
    the application on a mobile  device but places limits on what you can do
    with the installation file, including:
    \list
       \o  Self-signed applications cannot access the more sensitive
           \l{Capabilities and Signing}{capabilities} of the mobile device.
       \o  Security warnings will be displayed when you install the self-signed
           application on a mobile device.
       \o  Self-signed applications cannot be distributed commercially on Ovi
           Store.
    \endlist

    To get around these limitations, you need to go through the Symbian Signed
    process. The Symbian Signed organisation manages a public key
    infrastructure to provide public authentication of the information in the
    application signing certificates. Their security partner can validate your
    certificate and give you a Publisher ID. Then, when you sign an
    application, other people can be confident that the information in your
    certificate is correct and that the application does actually come from you.

    There are also options that do not require you to get a Publisher ID. For
    more detail about how the Symbian Signed process works, see
    \l{http://developer.symbian.org/wiki/index.php/Complete_Guide_To_Symbian_Signed}
    {Complete Guide to Symbian Signed}.

    When you have your own certificate and private key, you can specify them in
    the \gui{Create SIS Package} step in your build configuration.
Leena Miettinen's avatar
Leena Miettinen committed

    \image qtcreator-qt4-symbian-signing.png

    \section3 Capabilities and Signing

    Capabilities allow the Symbian platform to control access by applications to
    the functionality provided by the platform APIs. Access to capabilities is
    determined by the device configuration and how the application has been signed.

    Symbian Signed offers the following signing options depending on the
    capabilities that the application accesses:

    \list

        \o \bold{Express signed} for applications that access only user and system
        capabilities.

        \o \bold{Certified signed} for applications that access also restricted or
        device manufacturer capabilities.

        \note You need to request the rights to access device manufacturer
        capabilities from the manufacturer.

    \endlist

    For more information about how to choose the appropriate signing option, see
    \l{http://developer.symbian.org/wiki/index.php/Symbian_Signed_For_Distributing_Your_Application}{Symbian Signed For Distributing Your Application}.

    If you select a signing option that does not allow the application to access
    the defined capabilities, installing the application on mobile devices
    fails. To avoid problems, only define capabilities and link libraries to a project
    if you really need them.

    For more information about capabilities and how you can check which ones you
    need, see
    \l{http://developer.symbian.org/wiki/index.php/Capabilities_(Symbian_Signed)}{Capabilities (Symbian Signed)}
    and
    \l{http://doc.qt.nokia.com/4.7-snapshot/platform-notes-symbian.html#required-capabilities}{Required Capabilities for Qt Applications}.

    For more information on how to define capabilities for a project, see
    \l{http://doc.qt.nokia.com/4.7-snapshot/qmake-platform-notes.html#capabilities}{Capabilities}.

    \section3 Application UID

    A UID is a globally unique identifier that is used to
    uniquely identify, for example, an object or file type. In Symbian development,
    objects are identified by compound identifiers that are constructed from three
    UIDs, namely UID1, UID2, and UID3. UID1 and UID2 specify the category of an
    object, whereas UID3 identifies a particular object, such as an application.

    When you create a \gui {Mobile Qt Application}, Qt Creator adds a UID3 suitable for
    development and debugging automatically to the application .pro file. However, to
    distribute your application and get it Symbian signed, you must apply for a UID
    from Symbian, who manages the allocation of UIDs. You can request UIDs either one
    at a time or as preallocated blocks on the \l{https://www.symbiansigned.com/app/page}{Symbian Signed}
    web site.

    Replace the testing UID with the distribution UID in the .pro file before you
    build the final installation package. For more information, see
    \l{http://doc.qt.nokia.com/4.7-snapshot/qmake-platform-notes.html#unique-identifiers}{Unique Identifiers}.
Leena Miettinen's avatar
Leena Miettinen committed

    \section2 Building and Running for Symbian Emulator
Leena Miettinen's avatar
Leena Miettinen committed

    Select
    the \gui{Symbian Emulator} target as the active one, and build and run your
    project.

Leena Miettinen's avatar
Leena Miettinen committed

    If you cannot build the application, check if:
     \list
        \o You selected the Symbian Device target for building the application.
        \o The settings for the Qt version you use to build your project are
           correct. The path to the Symbian SDK must point to the Symbian SDK
Leena Miettinen's avatar
Leena Miettinen committed
           installation directory.  Select \gui Tools > \gui Options...
           > \gui Debugger > \gui{Symbian TRK} and check if it points to the
           debugger toolchain.
     \endlist
    If you cannot run the application on a device, check if:
     \list
        \o The device is connected through the USB cable in \e{PC Suite} mode.
        \o \gui{App TRK} is running on the device, using the USB connection,
           with the status \e connected.
        \o The device is detected and selected in the run configuration
           details.
     \endlist

    If you cannot run the application in the emulator, check if:
     \list
        \o You selected the \gui{Symbian Emulator} target for your application.

        \o If you cannot select \gui {Symbian Emulator} as target, check that
        Carbide.c++ is installed correctly and that the path to the Carbide.c++
        installation directory is specified in the \gui{Carbide directory} field
        in the build settings.

Leena Miettinen's avatar
Leena Miettinen committed
        \o If the emulator process cannot be started, try closing Qt Creator and
           starting the application directly from your file manager. Having
           done this, Qt Creator should be able to run your projects in the
           emulator.
Leena Miettinen's avatar
Leena Miettinen committed
     \endlist

     \note Qt Creator does not create release configurations for the
     \gui {Symbian Emulator} target, because Symbian Emulator supports only debug
     builds.

Leena Miettinen's avatar
Leena Miettinen committed
    If this does not help to solve your problem, search the qt-creator@trolltech.com
    mailing list archives or provide feedback to us via the methods described on the
    \l{http://qt.gitorious.org/qt-creator/pages/Home}{Qt Creator Development Wiki}.

    \section1 Building with Remote Compiler

    The \gui {Remote Compiler} target is an interface to a compilation service at
    Forum Nokia. It provides a simple, standardized environment for building Qt
    applications and creating installation packages for Symbian and Maemo devices
    when you do not have the necessary tool chains and SDKs installed or they are
    not supported on the development PC. You can choose from a set of supported
    devices, such as S60 3rd Edition or S60 5th Edition devices.

    \note Remote Compiler is an experimental component that you must install
    separately from the package that is included in the Nokia Qt SDK.

    \list 1

        \o In the Nokia Qt SDK installation directory, double-click
        SDKMaintenanceTool.exe to install \gui {Experimental APIs}.

        \o In Qt Creator, choose \gui {Tools > Options > Projects > Remote Compiler}
        to log on to Forum Nokia.

        \image remotecompiler-fn-logon.png "Remote Compiler options"

        \o Choose \gui {Projects}.

        \o Click
        \inlineimage qtcreator-qt4-addbutton.png "Add Target button"
        and select \gui {Remote Compiler} to add Remote Compiler as a target.

        \o Click \gui Add to add mobile device platforms as build configurations.

        \o Click the \gui {Target Selector} and select a build configuration.

        \o Choose \gui {Build > Build All}.

    \endlist

    The installation package is generated in the \gui {Build directory} on
    the development PC.

    For more information about Remote Compiler, choose \gui {Help > Contents >
    Remote Compiler}. The document is added during the installation of experimental
    APIs.

*/


/*!
    \contentspage index.html
    \previouspage creator-building-targets.html
    \page creator-build-settings.html
    \nextpage creator-run-settings.html

    \title Specifying Build Settings

    You specify build settings in the \gui Projects mode.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

    To add a new build configuration, click \gui Add and select the type of
    configuration you would like to add. You can add as many build
    configurations as you need.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

    To delete the build configuration currently selected, click \gui Remove.

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

    To edit a build configuration:
    \list 1
        \o Select the build configuration you want to edit in
           \gui{Edit Build Configuration}.
        \o In section \gui General, you can specify:
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
            \o The \l{glossary-project-qt}{Qt version} you want to use to
               build your project. For more information, see
               \l{Selecting the Qt version}.
            \o The tool chain required to build the project.
            \o By default, projects are built in a separate directory
               from the source directory, as \l{glossary-shadow-build}{shadow builds}.
               This keeps the files generated for each target platform separate.

               \note Shadow building is not supported by the Symbian build system.
               Also, shadow building on Windows is not supported for Maemo.
               If you only build for one target platform, you can deselect
               the \gui{Shadow Build} checkbox.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \endlist
con's avatar
con committed

con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    The build system of Qt Creator is built on qmake and make. In
    \gui{Build Steps} you can change the settings for qmake and make. Qt
    Creator runs the make command using the Qt version defined for the current
    build configuration.
con's avatar
con committed

    \image qtcreator-build-steps.png "Build steps"

    \section1 Clean Steps
con's avatar
con committed

    You can use the cleaning process to remove intermediate files. This process
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    might help you to fix obscure issues during the process of building a
    project.
con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    You can define the cleaning steps for your builds in the \gui{Clean Steps}:
    \list
        \o To add a clean step using make or a custom process, click
           \gui{Add clean step} and select the type of step you want to add.

           By default, custom steps are disabled. Activate custom steps by
           checking the \gui{Enable custom process step} check-box.
        \o To remove a clean step, click \gui{Remove Item}.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
        \o To change the order of steps, click
           \inlineimage qtcreator-movestep.png
           .
    \endlist
con's avatar
con committed

con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    You can specify the environment you want to use for building in the
    \bold{Build Environment} section. By default, the environment in which Qt
    Creator was started is used and modified to include the Qt version.
    Depending on the selected Qt version, Qt Creator automatically sets the
    necessary environment variables. You can edit existing environment
    variables or add, reset and unset new variables based on your project
    requirements.
con's avatar
con committed

*/


/*!
    \contentspage index.html
    \previouspage creator-build-settings.html
    \page creator-run-settings.html
    \nextpage creator-editor-settings.html

    \title Specifying Run Settings
con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    Qt Creator automatically creates run configurations for your project.
    To view and modify the settings, select \gui {Projects > Run}.
    The settings to specify depend on the type of the project: qmake project
    or Qt Quick project.

    Click \gui Add to add run settings for a project and \gui Remove to remove
    the current settings.

    \section1 Specifying Run Settings for qmake Projects

    The run configurations for qmake projects derive their executable from the parsed .pro
    files.

    \section2 Specifying Run Settings for Desktop Targets

    You can specify command line arguments to be passed to the executable
    and the working directory to use. The working directory defaults to
    the directory of the build result.

    For console applications, check the \gui{Run in Terminal} check box.
    If you need to run with special environment variables set up, you
    also do it in the run configuration settings.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \image qtcreator-pprunsettings.png
    You can also create custom executable run configurations where you
    can set the executable to be run. For more information, see
    \l{Specifying a Custom Executable to Run}.

    \section2 Specifying Run Settings for Symbian Devices

    Qt Creator automatically detects Symbian devices that are connected to
    the development PC with an USB cable.
    If only one device is detected, the application is deployed
    and run on it. If multiple devices are connected to the PC,
    make sure that the correct device is selected in the
    \gui {Symbian Device} run settings for your project.

    You can also pass command line arguments to your application on the device.
    Press the \gui{Device info button} to get more information about the selected
    device, such as the CPU type and the running TRK version.

    \image qtcreator-symbian-run-settings.png "Run settings for Symbian devices"

    \section2 Specifying Run Settings for Maemo Devices

    To run an application on a Maemo device, create and select
    a device configuration in the Maemo run settings for your project.
    You can also pass command line arguments to your application.

    \image qtcreator-screenshot-run-settings.png "Run settings for Maemo devices"

    \section1 Specifying a Custom Executable to Run

    If you use cmake or the generic project type in Qt Creator, or want
    to run a custom desktop executable, create a \gui {Custom Executable}
    run configuration for your project.

    Specify the executable to run, command line arguments, working directory,
    and environment variables to use.

    \image qmldesigner-run-custom-exe.png "Run settings for custom executables"

    \section1 Specifying Run Settings for Qt Quick Projects

    Select run settings in the \gui {Run configuration} field. The settings
    are specified automatically and, you mostly need to change them if you
    develop applications that use both C++ and QML:
        \o \gui {QML Viewer} is the path to the \QQV executable.
        Qt Creator ships with a specific version of \QQV and imported
        modules, which is used by default. If you develop applications
        that use both C++ and QML, you must select the \QQV version
        shipped with your Qt version here.
        \o \gui {QML Viewer arguments} sets arguments for running \QQV.
        The \c{-I <directory>} argument searches for C++ or QML plugins from
        the project folder. For a list of available arguments, enter \c {qml --help}
        on the command line.

        \o \gui {Main QML file} is the Qt Quick project file.
        \o \gui {Debugging address} is the IP address to access \QQV.
        \o \gui {Debugging port} is the port to access \QQV. You can use any
        free port in the registered port range.

    \endlist

    \image qmldesigner-run-settings.png "Run settings for Qt Quick projects"

*/
/*!
    \contentspage index.html
    \previouspage creator-run-settings.html
    \page creator-editor-settings.html
    \nextpage creator-build-dependencies.html

    \title Specifying Editor Settings

    To define the default file encoding, select the desired encoding in \gui Projects >
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \gui{Editor Settings}. By default, the Qt Creator uses the file encoding
    used by your system.

    \image qtcreator-editor-settings.png "Editor Settings view"

*/

/*!
    \contentspage index.html
    \previouspage creator-editor-settings.html
    \page creator-build-dependencies.html
    \nextpage creator-debugging.html
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

    If you have multiple projects loaded in your session, you can define the
    dependencies between them. Inter-project dependencies affect the build
    order of your projects.
    \note Inter-project dependencies are unrelated inside a qmake
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    project.

    \image qtcreator-build-dependencies.png "Dependencies view"
    To define the dependencies between projects:
        \o In \gui Projects, select a project.
        \o Click \gui Dependencies.
        \o Select projects as dependencies.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \endlist
con's avatar
con committed
*/

con's avatar
con committed
/*!
    \contentspage index.html
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \previouspage creator-quick-tour.html
    This section contains examples that illustrate how to use Qt Creator
    to create, build, and run simple
        \o \l{Creating a Mobile Application with Nokia Qt SDK}
    \page creator-mobile-example.html
    \nextpage creator-qml-application.html

    \title Creating a Mobile Application with Nokia Qt SDK
    \note 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.

    \image qtcreator-batteryindicator-screenshot.png

    \section1 Creating the Battery Indicator Project

    \note Create the project with the \gui{Help} mode active so that you can follow
    these instructions while you work.

    \list 1

        \o Select \gui{File > New File or Project > Qt Application Project > Mobile Qt
        Application > Choose}.

        \image qtcreator-new-mobile-project.png "New File or Project dialog"

        The \gui{Introduction and Project Location} dialog opens.

        \image qtcreator-mobile-intro-and-location.png "Introduction and Project Location dialog"

        \o In the \gui{Name} field, type \bold {BatteryIndicator}.

        \o In the \gui {Create in} field, enter the path for the project files. For example,
        \c {C:\Qt\examples}, and then click \gui{Next}.

        The \gui{Select Required Qt Versions} dialog opens.

        \image qtcreator-mobile-project-qt-versions.png "Select Required Qt Versions dialog"

        \o Select \gui Maemo, \gui {Qt Simulator}, and \gui {Symbian Device} targets,
        and click \gui{Next}.

        \note Targets are listed if you installed the appropriate development
        environment, for example, as part of the Nokia Qt SDK.

        The \gui{Class Information} dialog opens.

        \image qtcreator-mobile-class-info.png "Class Information dialog"

        \o In the \gui{Class Name} field, type \bold {BatteryIndicator} as the class name.

        \o In the \gui{Base Class} list, select \bold {QDialog} as the base class type.

        \note The \gui{Header File}, \gui{Source File} and \gui{Form File} fields are
        automatically updated to match the name of the class.

        \o Click \gui{Next}.

        The \gui{Project Management} dialog opens.

        \image qtcreator-mobile-project-summary.png "Project Management dialog"

        \o Review the project settings, and click \gui{Finish} to create the project.

    \endlist

    The BatteryIndicator project now contains the following files:

    \list

        \o batteryindicator.h
        \o batteryindicator.cpp
        \o main.cpp
        \o batteryindicator.ui
        \o BatteryIndicator.pro

    \endlist

    \image qtcreator-mobile-project-contents.png "Project contents"

    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.

    \section1 Declaring the Qt Mobility API

    The \gui 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:

    \code

    CONFIG += mobility
    MOBILITY = systeminfo

    \endcode

    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
    \l {http://doc.qt.nokia.com/qtmobility-1.0/quickstart.html}{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.

    \code

    symbian {
        TARGET.UID3 = 0xecbd72d7
        # TARGET.CAPABILITY +=
        TARGET.EPOCSTACKSIZE = 0x14000
        TARGET.EPOCHEAPSIZE = 0x020000 0x800000
    }

    \endcode

    \section1 Designing the User Interface

    \list 1

        \o In the \gui{Editor} mode, double-click the batteryindicator.ui
        file in the \gui{Projects} view to launch the integrated \QD.

        \o Drag and drop a \gui{Progress Bar} (\l{http://doc.qt.nokia.com/4.7-snapshot/qprogressbar.html}{QProgressBar})
        widget to the form.

        \image qtcreator-mobile-project-widgets.png "Adding widgets to the UI"

        \o In the \gui Properties pane, change the \gui objectName to
        \bold batteryLevelBar.

        \o Right-click the \gui BatteryIndicator object and select
        \gui {Lay Out > Lay Out Horizontally} to ensure that the battery
        indicator widget size is adjusted correctly on Maemo devices.

        To adjust widget size correctly on Qt Simulator, remove the condition
        from the main.cpp file (displayed in the following code snippet) and just
        leave the \c {w.showMaximized();} line:

        \snippet examples/batteryindicator/main.cpp 0


    \endlist

    \section1 Completing the Header File

    The batteryindicator.h file contains some of the necessary #includes, a
    constructor, a destructor, and the \c{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.

    \list 1

        \o In the \gui{Projects} view, double-click the \c{batteryindicator.h} file
        to open it for editing.

        \o Include the System Info header file, as illustrated by the following
        code snippet:

        \snippet examples/batteryindicator/batteryindicator.h 1

        \o Add a shortcut to the mobility name space, as illustrated by the
        following code snippet:

        \snippet examples/batteryindicator/batteryindicator.h 2

        \o Declare a private function in the \c{private} section, after the
        \c{Ui::BatteryIndicator} function, as illustrated by the following code
        snippet:

        \snippet examples/batteryindicator/batteryindicator.h 3

    \endlist

    \section1 Completing the Source File

    Now that the header file is complete, move on to the source file,
    batteryindicator.cpp.

    \list 1

        \o In the \gui{Projects} view, double-click the batteryindicator.cpp file
        to open it for editing.

        \o Create a QSystemDeviceInfo object and set its value. Then connect the signal
        that indicates that battery level changed to the \c setValue
        slot of the progress bar. This is illustrated by the following code snippet:

        \snippet examples/batteryindicator/batteryindicator.cpp 1

        \o Use the constructor to set initial values and make sure that the
         created object is in a defined state, as illustrated by the following
         code snippet:

         \snippet examples/batteryindicator/batteryindicator.cpp 2

    \endlist

    \section1 Compiling and Running Your Program

    Now that you have all the necessary code, select \gui {Qt Simulator}
    as the target and click the
    \inlineimage qtcreator-run.png
    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 \gui {Scripting > examples > runOutOfBattery.qs > Run}.

    \image qtcreator-mobile-simulated.png "Mobile example in Qt Simulator"

    \section1 Testing on a Symbian Device

    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.

    \list 1

        \o Install Qt 4.6.2 libraries, the Qt mobile libraries, and the TRK
        debugging application on the device. For more information,
        see \l{Setting Up Development Environment for Symbian}.

        \o Start TRK on the device.

        \o Click the \gui {Target Selector} and select \gui {Symbian Device}.

        \o Click \gui Run to build the application for the Symbian device.

    \endlist

    \section1 Testing on the Maemo Emulator

    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 \l{Using the Maemo Emulator}.

*/

/*!
    \contentspage index.html
    \previouspage creator-getting-started.html
    \page creator-build-example-application.html
    \nextpage creator-writing-program.html

    \title Building and Running an Example Application

    You can test that your installation is successful by opening an existing
    example application project.

    \list 1

        \o On the \gui Welcome page, select \gui {Choose an example... >
        Animation Framework > Animated Tiles}.

        \image qtcreator-gs-build-example-open.png "Selecting an example"

        \o Select targets for the project. Select at least Qt Simulator
        and one of the mobile targets, Maemo or Symbian Device, depending on
        the device you develop for.

        \image qtcreator-gs-build-example-targets.png "Selecting targets"

        \note You can add targets later in the \gui Projects mode.

        \o To test the application in Qt Simulator, click the \gui {Target
        Selector} and select \gui {Qt Simulator}.

        \image {qtcreator-gs-build-example-select-qs.png} "Selecting Qt Simulator as target"

        \o Click
        \inlineimage{qtcreator-run.png}
        to build the application and run it in Qt Simulator.

        \o To see the compilation progress, press \key{Alt+4} to open the
        \gui Compile Output pane.

        The \gui Build progress bar on the toolbar turns green when the project
        is successfully built. The application opens in Qt Simulator.

        \image {qt-simulator.png} "Qt Simulator"

        \o Change the settings in the
        \gui View pane, for example, to toggle the orientation by clicking
        \gui {Rotate Device}, or choose from the various Symbian and Maemo
        configurations by clicking \gui {Device}. You can also simulate various
        mobile functions and create your own scripts.

        \o To test the application on a Symbian device install Qt 4.6.2
        and the TRK debugging application on the device. For more information,
        see \l{Setting Up Development Environment for Symbian}.

        \o Click the \gui {Target Selector} and select \gui {Symbian Device}.

        \o Click \gui Run to build the application for the Symbian device.

    \endlist

*/


/*!
    \contentspage index.html
    \previouspage creator-mobile-example.html
    \nextpage creator-project-managing.html
con's avatar
con committed

    \note This tutorial assumes that you are familiar with the \l {http://doc.qt.nokia.com/4.7-snapshot/declarativeui.html}
    This tutorial describes how to use Qt Creator to create a small
    \image qmldesigner-helloworld-edited.png "Hello World"