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  · 

Searching With the Locator

The locator provides one of the easiest ways in Qt Creator to browse through projects, files, classes, methods, documentation and file systems. You can find the locator in the bottom left of the Qt Creator window.

To activate the locator, press Ctrl+K (Cmd+K on Mac OS X) or select Tools > Locate....

To edit the currently open project's main.cpp file using the locator:

  1. Activate the locator by pressing Ctrl+K.
  2. Enter main.cpp.

  3. Press Return.

    The main.cpp file opens in the editor.

It is also possible to enter only a part of a search string. As you type, the locator shows the occurrences of that string regardless of where in the name of an component it appears.

To narrow down the search results, you can use the following wildcard characters:

  • To match any number of any or no characters, enter *.
  • To match a single instance of any character, enter ?.

Using the Locator Filters

The locator allows you to browse not only files, but any items defined by locator filters. By default, the locator contains filters for:

  • Locating any open document
  • Locating files anywhere on your file system
  • Locating iles belonging to your project, such as source, header resource, and .ui files
  • Locating class and method definitions in your project or anywhere referenced from your project
  • Locating class and method definitions in the current document
  • Locating a specific line in the document displayed in your editor
  • Opening help topics, including Qt documentation
  • Performing web searches
  • Running text editing macros that you record and save. For more information, see Using Text Editing Macros

To use a specific locator filter, type the assigned prefix followed by Space. The prefix is usually a single character.

For example, to locate symbols matching QDataStream:

  1. Activate the locator.
  2. Enter : QDataStream (: (colon) followed by a Space and the symbol name (QDataStream)).

    The locator lists the results.

By default the following filters are enabled and you do not need to use their prefixes explicitly:

  • Going to a line in the current file (l).
  • Going to an open file (o).
  • Going to a file in any open project (a).

Using the Default Locator Filters

The following locator filters are available by default:

FunctionEnter in locatorExample
Go to a line in the current file.l Line number

Go to a symbol definition.: Symbol name

Go to a symbol definition in the current file.. Symbol name

Go to a help topic.? Help topic

Search for a term by using a web search engine.r Search term

Go to an open file.o File name

Go to a file in the file system (browse the file system).f File name

Go to a file in any project currently open.a File name

Go to a file in the current project.p File name

Go to a class definition.c Class name

Go to a method definition.m Method name

Execute a text editing macro.rm Macro name

Creating Locator Filters

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 a locator filter:

  1. In the locator, click and select Configure.... to open the Locator options.

  2. Click Add.
  3. In the Filter Configuration dialog:
    • Name your filter.
    • Select at least one directory. The locator searches directories recursively.
    • Define the file pattern as a comma separated list. For example, to search all .h and .cpp files, enter *.h,*.cpp
    • Specify the prefix string.

      To show only results matching this filter, select Limit to prefix.

  4. Click OK.

Adding Web Search Engines

You can use the Web Search (r) locator filter to perform web searches. URLs and search commands for Bing, Google, Yahoo! Search, cplusplus.com, and Wikipedia are configured by default.

To find out the format of the search command to use for your favorite web search engine, perform a search in your browser and copy the resulting URL to the locator filter configuration. Replace the search term with the variable %1.

To add URLs and search commands to the list:

  1. Select Tools > Options > Locator > Web Search (prefix: r) > Edit.
  2. Select Add to add a new entry to the list.

    "Filter Configuration dialog"

  3. Double-click the new entry to specify a URL and a search command. For example, http://www.google.com/search?q=%1.
  4. Click OK.

Configuring the Locator Cache

The locator searches the files matching your file pattern in the directories you have selected and caches that information. The cache for all default filters is updated as you write your code. By default, Qt Creator updates the filters created by you once an hour.

To update the cached information manually, click and select Refresh.

To set a new cache update time:

  1. Select Tools > Options... > Locator.
  2. In Refresh interval, define new time in minutes.
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

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