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  · 

Tips and Tricks

Switching Between Modes

Qt Creator uses different modes for different purposes. You can quickly switch between these modes with the following keyboard shortcuts:

  • Welcome mode Ctrl+1
  • Edit mode Ctrl+2
  • Design mode Ctrl+3
  • Debug mode Ctrl+4
  • Projects mode Ctrl+5
  • Help mode Ctrl+6

For more information about Qt Creator modes, see Qt Creator Modes.

Moving Between Open Files

To quickly move between currently open files, press Ctrl+Tab.

To move forward in the location history, press Alt+Right (Cmd+Opt+Right on Mac OS). To move backward, press Alt+Left (Cmd+Opt+Left on Mac OS). For example, if you use the Locator to jump to a symbol in the same file, you can jump back to your original location in that file by pressing Alt+Left.

Moving To the Edit Mode

To move to the Edit mode and currently active file, press Esc.

If you already are in the Edit mode:

  • The first press moves focus to the editor
  • The second press closes secondary windows

Using the Filter in Options Dialog

To find specific settings you require in Tools > Options... use the filter located at the top left of the Options dialog box.

Opening Output Panes

The output panes provide a list of errors and warnings encountered during a build, detailed output from the compiler, status of a program when it is executed and debug output, as well as search results.

To open output panes, use the following shortcuts:

  • Build Issues pane Alt+1 (Cmd+1 on Mac OS X)
  • Search Results pane Alt+2 (Cmd+2 on Mac OS X)
  • Application Output pane Alt+3 (Cmd+3 on Mac OS X)
  • Compile Output pane Alt+4 (Cmd+4 on Mac OS X)

For more information about output panes, see Viewing Output.

Using Keyboard Shortcuts

Qt Creator provides many useful keyboard shortcuts. You can see the keyboard shortcut for a menu command in the menu or the tooltip for a button.

To customize, import or export keyboard shortcuts, select Tools > Options... > Environment > Keyboard.

Running Qt Creator From Command Line

You can launch Qt Creator from command line using the name of an existing session or .pro file by giving the name as the command argument.

For example, running qtcreator somesession, launches Qt Creator and loads session somesession.

Note: Make sure Qt Creator is included in the PATH environment variable. This can be done by typing the following in the command line:

 set PATH=c:\qtsdk\mingw\bin;c:\qtsdk\qt\bin;%PATH%

Showing and Hiding the Sidebar

To toggle the sidebar in the Edit and Debug modes, click or press Alt+0 (Cmd+0 on Mac OS X).

For more information on using the sidebar, see Browsing Project Contents.

Moving To Symbols

To move straight to a symbol used in a project, select the symbol in the Editor toolbar drop-down menu. For more information on the editor toolbar, see Using the Editor Toolbar.

To jump to a symbol in the current file, press Ctrl+K to open the Locator, enter a period (.), and start typing the symbol name. Then select the symbol in the list. For more information on using the locator, see Searching With the Locator.

Press Ctrl (Cmd on Mac OS) and click a symbol to move directly to the definition or the declaration of the symbol. You can also move the cursor on the symbol and press F2. For more information, see Moving to Symbol Definition or Declaration.

Displaying Signals and Slots

If an instance of a class is derived from QObject, and you would like to find all other objects connected to one of your object's slots using Qt's signals and slots mechanism, select Tools > Options... > Debugger > Debugging Helper > Use Debugging Helper.

In the Locals and Expressions view, expand the object's entry and open the slot in the slots subitem. The objects connected to this slot are shown as children of the slot. This method works with signals too.

For more information about the Locals and Expressions view, see Locals and Expressions.

Displaying Low Level Data

If special debugging of Qt objects fails due to data corruption within the debugged objects, you can switch off the debugging helpers. When debugging helpers are switched off low-level structures become visible.

To switch off the debugging helpers:

  1. Select Tools > Options... > Debugger > Debugging Helper.
  2. Uncheck the Use Debugging Helper checkbox.

Showing Tooltips in Debug Mode

To inspect the value of variables from the editor, you can turn on tooltips. Tooltips are hidden by default for performance reasons.

  1. Select Tools > Options... > Debugger > General.
  2. Select the Use tooltips in main editor while debugging check box.

When you hover over a variable in the code editor in Debug mode, a tooltip is displayed. To keep the tooltip visible, click the pin button. You can expand pinned tooltips to view their full content.

Pinned tooltips are stored in the session. To close all pinned tooltips, select Close Editor Tooltips in the context menu in the Locals and Expressions view.

Locating Files

The Locator provides one of the easiest ways in Qt Creator to browse through projects, files, classes, methods, documentation and file systems. To quickly access files not directly mentioned in your project, you can create your own locator filters. That way you can locate files in a directory structure you have defined.

To create locator filters, select Tools > Options... > Locator > Add.

For more information, see Creating Locator Filters.

Adding a License Header Template for C++ Code

A file containing a license header for C++ can be specified under Tools > Options... > C++ > License Template. It may contain special placeholders enclosed in %% that are replaced when generating a new file:

  1. %YEAR%: Year
  2. %MONTH%: Month
  3. %DAY%: Day of the month
  4. %DATE%: Date
  5. %USER%: User name
  6. %FILENAME%: File name
  7. %CLASS%: Class name (if applicable)
  8. %$VARIABLE%: Contents of environment variable VARIABLE.
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. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. 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
  4. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 12
  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 Qt Developer Network au hasard

Logo

La création de colonnes dans une ListView en QML

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 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