Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

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:

  • The work is being done within a Linux environment
  • Qt Extended has already been installed, configured and built with quicklaunching enabled.

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:
    • qbuild.pro
    • mynewapp.desktop
    • mynewapp.h and mynewapp.cpp
    • main.cpp
    • mynewappbase.ui
    • help/html/mynewapp.html
  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.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 44
  2. Microsoft ouvre aux autres compilateurs C++ AMP, la spécification pour la conception d'applications parallèles C++ utilisant le GPU 22
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. RIM : « 13 % des développeurs ont gagné plus de 100 000 $ sur l'AppWord », Qt et open-source au menu du BlackBerry DevCon Europe 0
  5. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
Page suivante

Le Qt Developer Network au hasard

Logo

Compiler l'add-in Qt de Visual Studio

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtextended4.4
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web