How do I:
- Switch between modes
- Move between open files
- Switch to Edit mode
- Find a specific setting
- View output
- Find keyboard shortcuts
- Run Qt Creator from the command line
- Show and hide sidebars
- Move to symbols
- Quickly locate files using the keyboard
- Perform calculations
- Jump to a function in QML code
- Add a license header template for C++ code
- Paste text from my clipboard history
- Sort lines alphabetically
- Enclose selected code in curly braces, parentheses, or double quotes
- Select the enclosing block in C++
- Add my own code snippets to the auto-complete menu
- Quickly write down notes somewhere
- Configure the amount of recent files shown
- Search and replace across files using a regular expression
Switch 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 Selecting Modes.
Move 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 macOS). To move backward, press Alt+Left (Cmd+Opt+Left on macOS). 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.
Switch to 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
Find a specific setting
To find specific settings in Edit > Preferences, use the filter located at the top left of the Preferences dialog.
The taskbar shows output from several sources, such as a list of errors and warnings encountered during a build, detailed output from the compiler, status of a program when it is executed, debug output, or search results.
To view different types of output, use the following shortcuts:
- Issues - Alt+1 (Cmd+1 on macOS)
- Search Results - Alt+2 (Cmd+2 on macOS)
- Application Output - Alt+3 (Cmd+3 on macOS)
- Compile Output - Alt+4 (Cmd+4 on macOS)
For additional ways to view other types of output, see Viewing Output.
Find keyboard shortcuts
Qt Creator has 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 Edit > Preferences > Environment > Keyboard.
Run Qt Creator from the command line
You can launch Qt Creator from the command line using the name of an existing session or project file by entering the name as the command argument.
For example, running
qtcreator somesession, launches Qt Creator and loads the session called somesession.
For more information, see Using Command Line Options.
Show and hide sidebars
You can toggle the left and right sidebar in some Qt Creator modes.
To toggle the left sidebar, click (Hide Left Sidebar/Show Left Sidebar) or press Alt+0 (Cmd+0 on macOS).
To toggle the right sidebar, click (Hide Right Sidebar/Show Right Sidebar) or press Alt+Shift+0 (Cmd+Shift+0 on macOS).
For more information on using the sidebars, see Browsing Project Contents.
Move 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 macOS) 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.
Quickly locate files using the keyboard
Use the Locator to browse through projects, files, classes, functions, 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 Edit > Preferences > Environment > Locator > Add.
For more information, see Creating Locator Filters.
Open the Locator with Ctrl+K and type =, followed by a space. You can now do basic calculations, with options to copy the results to the clipboard by navigating through the entries and pressing Enter.
Jump to a function in QML code
Open the Locator with Ctrl+K and type m, followed by a space. You can now go directly to any QML method in the file.
Add a license header template for C++ code
Specify a file that has a license header for C++ in Edit > Preferences > C++ > File Naming > License template.
The license file may have special placeholders enclosed in
%% that are replaced when generating a new file:
%DAY%: Day of the month
%FILENAME%: File name
%CLASS%: Class name (if applicable)
%$VARIABLE%: Contents of environment variable
Paste text from my clipboard history
Qt Creator stores copied text in clipboard history. To retrieve clips from the history, press Ctrl+Shift+V until the clip appears. The number of clips in the history is fixed to 10.
Sort lines alphabetically
To sort selected lines alphabetically, select Edit > Advanced > Sort Selected Lines or press Alt+Shift+S (or Ctrl+Shift+S on macOS).
Enclose selected code in curly braces, parentheses, or double quotes
When you have selected code and enter one of the following opening characters, the matching closing character is added automatically at the end of the selection:
To specify whether to automatically insert matching characters, select Edit > Preferences > Text Editor > Completion.
Select the enclosing block in C++
Add my own code snippets to the auto-complete menu
You can add, modify, and remove snippets in the snippet editor. To open the editor, select Edit > Preferences > Text Editor > Snippets.
For more information, see Adding and Editing Snippets.
Quickly write down notes somewhere
Select File > New File > General > Scratch Buffer. Alternatively, Ctrl+N can be used to open this dialog, which is fully navigable via keyboard by using the up and down arrow keys and the tab key.
This creates a new empty text file and saves it to the temporary directory on your machine. You can use it to write down notes without having to worry about deleting the file afterwards. The operating system will eventually remove the file automatically. If you want to keep the file, you can easily save it as a new file somewhere else. If you accidentally close the file, you can find it in the File > Recent Files menu.
Configure the amount of recent files shown
Set the value of Edit > Preferences > Environment > System > Maximum number of entries in "Recent Files".
Search and replace across files using a regular expression
As an example, say you want to replace equality checks (
foo == bar) with a function (
- Ensure that any work you have done is committed to version control, as the changes cannot be undone.
- Press Ctrl+Shift+F to bring up the Advanced Find form.
- Change the scope to whatever is appropriate for your search.
- Under the Search for text field, select the Use regular expressions check box.
- Enter the following text in the Search for text field:
if \((.*) == (.*)\)
- Press Search & Replace to see a list of search results.
- In the Replace with text field, enter the following text:
- Press Replace to replace all instances of the text.
For more information, see Advanced Search.
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.