[Previous: Qt Creator and Version Control Systems]
[Qt Creator Manual]
[Next: Debugging with Qt Creator]
Navigating Quickly Around Your Code with Locator
With Qt Creator, navigating to different locations in your project or on your disk, e.g., files, classes, methods, etc., is trivial using Locator -- a smart line edit at the bottom left of Qt Creator's window.

Suppose you would like to open your project's main.cpp file, click on Locator or use Ctrl+K (Mac OS X: Cmd+K), type in the file name and then press Return. The file will be opened in the editor. You can also type part of a file name and use the wildcard characters * and ? to match any number of any characters. A list of all files matching your criteria will be displayed.
Locator not only allows you to navigate files on disk but also other "locations", which are organized with Filters. Currently there are filters for:
- files anywhere on your hard disk (browsing through the file system),
- files from a subdirectory structure defined by you,
- files mentioned in your .pro files, such as source, header, resource, and .ui files,
- any open document,
- class and method definitions in your project or anywhere referenced from your project,
- help topics, including Qt's documentation, and,
- a specific line in the document displayed on your editor,
Some of these filters require you to activate them by typing an assigned prefix. This prefix is usually a single character followed by Space. For example, to jump to the definition of the class QDataStream, type: Ctrl+K (Mac OS X: Cmd+K) to activate Locator. Then type colon (:) followed by Space and the class name.
Below is a full list of QDataStream related output:

Filters can be added to provide quick navigation around files in a subdirectory structure defined by you. This way, you can acccess files you need, that are not directly mentioned in your project. Click on

and choose Configure... from the menu displayed.

This displays the Preferences dialog (Options on Mac Os X) for navigation filters. Click Add to create a new filter. In the Filter Configuration dialog below, give your filter a name, select your preferred directories, set file patterns with a comma separated list, and specify a prefix string.

After closing this dialog, Locator will search the directories you selected for files matching your file patterns, and the information will be cached. Click Refresh from the menu above to update the cached information.
The following table lists the filters currently available:
Function | Key Combination | Screenshot |
Go to a line in the current document | Ctrl+K, l, Space, and the line number | 
|
Go to a symbol definition | Ctrl+K, :, Space, and the function name | 
|
Go to a help topic | Ctrl+K, ?, Space, and the topic | 
|
Go to an opened document | Ctrl+K, o, Space, and the document name. | 
|
Go to a file in the file system (browse the file system) | Ctrl+K, f, Space, and the file name. | 
|
Go to a file in any project currently loaded | Ctrl+K, a, Space, and the function name. | 
|
Go to a file in the current project | Ctrl+K, p, Space, and the function name. | 
|
Go to a class definition | Ctrl+K, c, Space, and the class name. | 
|
Go to a method definition | Ctrl+K, m, Space, and the class name. | 
|
Note: By default, if you press Ctrl+K and do not use a prefix to specify a filter, three filters will be enabled: o, l, and a.
Note: On Mac OS X, use Cmd+K instead of Ctrl+K.
[Previous: Qt Creator and Version Control Systems]
[Qt Creator Manual]
[Next: Debugging with Qt Creator]
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) |
Trademarks |
Qt Creator 1.3.0 |
|