- Qt Creator Documentation
- Locator
- Qt Creator 17.0.0-beta1

Reference

# Locator

To set locator preferences, go to Preferences > Environment > Locator, or select > Configure in the locator field.

## Changing Locator Filters

You can change the preset locator filters to match your use case. For example, change the filter prefix and restrict the search to items that match the filter.

To configure a locator filter:

1. Go to Preferences > Environment > Locator.
2. Select a filter, and then select Edit.
3. Specify the prefix string.

4. To implicitly include the filter even when not typing a prefix as a part of the search string, select Include by default.

## Adding Web Search Engines

By default, the Web Search (r) locator filter includes the URLs and search commands for Bing, Google, Yahoo! Search, cplusplus.com, and Wikipedia.

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. Go to Preferences > Environment > Locator.
2. Select Web Search > Edit.
3. Select Add to add a URL filter to the list.

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

To add a new separate web search locator filter instead of updating the default filter, select Add > URL Template.

## Creating Locator Filters

To quickly access files not directly mentioned in your project, create your own directory filters. That way you can locate files in a directory structure you have defined.

To create custom locator filters:

1. Go to Preferences > Environment > Locator.
2. Select Add > Files in Directories to add a directory filter.

3. In Name, enter a name for your filter.
4. Select Add to add directories to Directories. The locator searches directories recursively.
5. In File pattern, specify file patterns to restrict the search to files that match the pattern. Separate the patterns with commas. For example, to search for all `.qml` and `.ui.qml` files, enter `*.qml,*.ui.qml`
6. In Exclusion pattern, specify file patterns to omit files from the search.
7. In Prefix, specify the prefix string.

   To implicitly include the filter even when not typing a prefix as a part of the search string, select Include by default.

8. Select OK.

## Configuring Locator Cache

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

To update the cached information manually, select > Refresh in the locator.

To set a new cache update time:

1. Go to Preferences > Environment > Locator.
2. In Refresh interval, set a new time in minutes.

## Hiding Long Paths

To hide the common part of absolute paths in the locator:

1. Go to Preferences > Environment > Locator.
2. Select Show Paths in Relation to Active Project to show relative paths.

See also Navigate with locator, How To: Search, Perform calculations, and Locator.

Reference