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  · 

Debugging Qt Quick Projects

Note: You need Qt 4.7.1 or later to debug Qt Quick projects. Debugging projects not created with the Qt Quick wizards is only supported with Qt 4.8, or later.

To debug Qt Quick applications running on devices, you must install Qt 4.7.4, or later, libraries on devices. To debug applications on Symbian devices, you must install also QML Viewer on them.

Setting Up QML Debugging

The process of setting up debugging for Qt Quick projects depends on the type of the project: Qt Quick UI or Qt Quick Application.

To debug Qt Quick UI projects:

  1. Select Projects, and then select the QML check box in the Run Settings, to enable QML debugging.
  2. Compile the QML Inspector debugging helper. For more information, see Debugging Helpers for QML.

To debug Qt Quick Applications:

  1. Select Projects, and then select the Link QML debugging library check box in Build Steps.

    You might have to compile the library first, by selecting the Compile link.

    "Build Steps"

    Note: Debugging requires opening a socket at a well-known port, which presents a security risk. Anyone on the Internet could connect to the application that you are debugging and execute any JavaScript functions. Therefore, you must make sure that the port is properly protected by a firewall.

  2. In the Run Settings, select the QML check box to enable QML debugging.
  3. Select Build > Rebuild Project to clean and rebuild the project.

To debug Qt Quick Applications on devices, install Qt 4.7.4, or later, libraries on devices. Then select the device as the target before you start debugging.

Mixed C++/QML Debugging

You can debug both the C++ and QML parts of your application at the same time: Select the checkboxes for both languages in the Run Settings. However, C++ breakpoints will be ignored until the debugger has attached also to the QML engine.

Starting QML Debugging

To start the application, choose Debug > Start Debugging > Start Debugging or press F5. Once the application starts running, it behaves and performs as usual. You can then perform the following tasks:

  • Debug JavaScript functions
  • Preview QML changes at runtime
  • Inspect QML at runtime

Debugging JavaScript Functions

You can use the Qt Creator Debug mode to inspect the state of your application while debugging. You can interact with the debugger in several ways, as described in the following sections:

Executing JavaScript Expressions

When the application is interrupted by a breakpoint, you can use the QML Script Console to execute JavaScript expressions in the current context. To open it, choose Window > View > QML Script Console.

"QML Script Console view"

You can type JavaScript expressions and use them to get information about the state or your application. For example, property values.

You can see the current value of a property by hovering over it in the code editor.

Applying QML Changes at Runtime

If you change property values or add properties in the code editor, the changes are updated in the running application when you save them. If live preview is not supported for an element, a message appears. Click Reload to preview the changes.

Reloading is enabled by default. To disable it, click "Apply Changes on Save button" on the toolbar.

Inspecting QML at Runtime

While the application is running, you can use the QML Inspector view to explore the object structure, debug animations, and inspect colors. To open the QML Inspector view, choose Window > View > QML Inspector. The view shows the properties of the currently selected QML element.

"QML Inspector view"

When you debug complex applications, you can use the inspection mode to jump to the position in code where an element is defined. You are switched to the inspection mode, when you click the Select, Zoom, or Color Picker button on the toolbar.

"QML Inspector toolbar"

When the Select tool is enabled, you can click elements in the running application to jump to their definitions in the code. The properties of the selected element are displayed in the QML Inspector view. The element hierarchy is displayed as a bread crumb path.

You can also right-click an element in the running application to view the element hierarchy as a context menu.

"QML Inspector"

To switch to the zoom mode, click the Zoom button. Click in the running application to zoom in. Right-click to open a context menu that contains zoom controls.

To inspect colors, click the Color Picker button. You can also click "Copy Color button" to copy the color definition to the clipboard.

To switch out of the inspection mode, deselect the Select, Zoom, and Color Picker button.

To move the application running in Qt QML Viewer to the front, select the Show Application on Top button.

Debugging Animations

To play and pause animations in the running application, select the Play/Pause Animations button on the toolbar or Debugging > Animations > Pause, or press Ctrl+..

To change the speed at which animations are played, select a value in Debugging > Animations or click and hold down the Play/Pause Animations button to select a value.

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. Microsoft ouvre aux autres compilateurs C++ AMP, la spécification pour la conception d'applications parallèles C++ utilisant le GPU 22
  2. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 27
  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. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
Page suivante

Le blog Digia au hasard

Logo

Déploiement d'applications Qt Commercial sur les tablettes Windows 8

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. 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