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  · 

Creating Qt Quick Projects

"New File or Project dialog"

When you create a new Qt Quick project from scratch, you have the following options:

  • Qt Quick Application creates a Qt Quick application project that can contain both QML and C++ code. The project includes a QDeclarativeView. You can build the application and deploy it on desktop and mobile target platforms. For example, you can create signed Symbian Installation System (SIS) packages for this type of projects.
  • Qt Quick UI creates a Qt Quick UI project with a single QML file that contains the main view. You can review Qt Quick UI projects in the QML Viewer and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of projects.
  • Custom QML Extension Plugin creates a C++ plugin that makes it possible to offer extensions that can be loaded dynamically into applications by using the QDeclarativeEngine class.

If you have existing QML applications that you want to run in Qt Creator or deploy to mobile devices, use the Qt Quick Application wizard to convert them to Qt Quick applications.

Creating Qt Quick UI Projects

  1. Select File > New File or Project > Qt Quick Project > Qt Quick UI > Choose....

    The Introduction and Project Location dialog opens.

    "Introduction and Project Location dialog"

  2. In the Name field, give a name to the project.

    Do not use spaces and special characters in the project name and path.

  3. In the Create in field, enter the path for the project files. For example, C:\Qt\examples. To select the path from a directory tree, click Browse.
  4. Click Next.

    "Project Management dialog"

  5. Review the project settings, and click Finish to create the project.

Qt Creator creates the following files:

  • .qmlproject project file defines that all QML, JavaScript, and image files in the project folder belong to the project. Therefore, you do not need to individually list all the files in the project.
  • .qml file defines an element, such as a component, screen, or the whole application UI.

The import statement in the beginning of the .qml file specifies the Qt modules to import. Each Qt module contains a set of default elements. Specify a version to get the features you want.

To use JavaScript and image files in the application, copy them to the project folder.

Creating Qt Quick Applications

  1. Select File > New File or Project > Qt Quick Project > Qt Quick Application > Choose....

    The Introduction and Project Location dialog opens.

    "Introduction and Project Location dialog"

  2. In the Name field, give a name to the project.

    Do not use spaces and special characters in the project name and path.

  3. In the Create in field, enter the path for the project files. For example, C:\Qt\examples. To select the path from a directory tree, click Browse.
  4. Click Next.

    The Application Type dialog opens.

    "Application Type dialog"

  5. Select the Qt Quick Component Set to use in your application. The built-in elements allow you to write cross-platform applications with custom look and feel. The components for Symbian and MeeGo Harmattan allow you to create applications with a native look and feel for the selected mobile platform.

    You can also import an existing QML file in this dialog.

  6. Click Next.

    The Target Setup dialog opens.

    "Target Setup dialog"

  7. Select the Qt versions to use as build targets for your project, and then click Next.

    Note: Qt Quick is supported since Qt 4.7, and therefore, only Qt 4.7 and later versions are displayed. Further, if you have only one supported Qt version installed, this dialog is skipped.

    The Mobile Options dialog opens.

    "Mobile Options dialog"

  8. In the Orientation behavior field, determine how the application behaves when the orientation of the device display rotates between portrait and landscape, and then click Next.

    Note: This dialog opens only if you select Maemo5 or Symbian Device target in the Target Setup dialog. On Harmattan, the Qt Quick Components for MeeGo provide native-looking rotation.

    The Symbian Specific dialog opens.

    "Symbian Specific dialog"

  9. In the Application icon (.svg) field, select an application icon for the Symbian Device target, or use the default icon.
  10. In the Target UID3 field, specify the Application UID, or use the default UID.

    Note: Qt Creator generates a UID for testing the application on a device. You need to change the UID when you deliver the application for public use.

  11. Click Next.

    The Maemo Specific dialog opens.

    "Maemo Specific dialog"

  12. In the Application icon field, select the application icon to use on Maemo or Harmattan targets, or use the default icon.

    The Project Management dialog opens.

    "Project Management" dialog

  13. In the Add to project field, you can add this project to another project as a subproject.
  14. In the Add to version control field, you can add the project to a version control system.
  15. Click Finish to create the project.

Qt Creator creates the necessary boilerplate files. Some of the files are specific to the Symbian, Maemo, or MeeGo Harmattan platform.

Importing QML Applications

If you have existing QML applications that you want to run in Qt Creator or deploy to mobile devices, use the Qt Quick Application wizard and select the main .qml file in your project. All the other files in the project are automatically added to the application project.

To import QML applications:

  1. Select File > New File or Project > Qt Quick Project > Qt Quick Application > Choose....
  2. Name the project and set its path, and then click Next.
  3. In the Application Type dialog, select the Use an existing .qml file option and specify the main .qml file of the project you want to import.

    "Application Type dialog"

  4. Click Next.
  5. Select the Qt versions to use as build targets for your project, and click Next.
  6. Specify options for deploying the application to mobile device targets, and click Next.
  7. Review the project settings, and click Finish to create the project.

Qt Creator adds references to the QML files to a project and creates the additional files necessary for deploying applications to mobile devices.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

[0]; s.parentNode.insertBefore(ga, s); })();
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 78
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. 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
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 6
Page suivante

Le Qt Quarterly au hasard

Logo

Les aventures de QLALR - utiliser QLALR pour générer un parseur pour une aventure textuelle

Qt Quarterly est la revue trimestrielle proposée par Nokia et à destination des développeurs Qt. Ces articles d'une grande qualité technique sont rédigés par des experts Qt. 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 qtcreator-2.3
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