- Qt Creator Documentation
- How To
- Qt Creator 17.0.1

Tutorials ◦ Reference

# How To

The following topics describe how to use Qt Creator to perform a particular task.

## Analyze

Use integrated code analysis tools to detect memory leaks, profile function execution, analyze CPU use, and eliminate unnecessary complexity of code. Other integrated tools provide code coverage and visualize trace events.

- Analyze CPU usage
- Analyze code with Clang-Tidy and Clazy
- Check code syntax
- Configure Clang diagnostics
- Create compiler explorer sessions
- Detect errors in C++ code with Cppcheck
- Detect memory leaks with Heob
- Detect memory leaks with Memcheck
- Explore compiler code
- Local analysis with Axivion
- Profile CMake code
- Profile QML applications
- Profile function execution
- Run Valgrind tools on external applications
- Set up code coverage from Coco
- Specify Valgrind settings for a project
- View Axivion static code analysis results
- View code coverage reports from Coco

## Build and Run

Use integrated cross-platform systems for build automation to compile your source code for different target platforms or with different compilers, debuggers, or Qt versions. Deploy applications to the target platforms and run them there.

- Activate custom output parsers
- Add custom output parsers
- Build for many platforms
- Configure projects for building
- Customize the build process
- Edit Qbs profiles
- Edit vcpkg manifest files
- Enable debugging
- Use compilation databases

### Build with CMake

CMake controls the software compilation process by using simple configuration files, called CMakeLists.txt files.

- Add CMake tools
- Add libraries to CMake projects
- Complete CMake code
- Debug CMake project files
- Edit CMake configuration files
- Format CMake files
- Manage files in CMake projects
- Override CMake settings for a project
- Profile CMake code
- Read CMake documentation
- View CMake project contents

### Build with qmake

qmake automates the generation of Makefiles based on the information in a project file that has the extension .pro.

- Add libraries to qmake projects
- Run qmake before building

### Run applications

Run applications on local and remote desktop systems, as well as on embedded and mobile devices that you connect to the computer.

- Configure projects for running
- Run Python applications
- Run in Qt Application Manager
- Run on many platforms
- Specify a custom executable to run

## Create Models and Diagrams

Create Universal Modeling Language (UML) style models with structured and behavioral diagrams that offer different views to your system. Or, use a file wizard to create State Chart XML (SCXML) files with boilerplate code and edit them with an SCXML editor.

- Create UML-style models
- Create class diagrams
- Create component diagrams
- Create package diagrams
- Create state charts

## Debug

Use debuggers to inspect the state of your application while it is running.

- Add breakpoints
- Attach the debugger to running applications
- Attach the debugger to starting processes
- Debug C++ applications on VxWorks devices
- Debug CMake project files
- Debug crashed processes on Windows
- Debug on Android devices
- Debug remotely with CDB
- Debug remotely with GDB
- Examine complex values in Debug views
- Inspect basic Qt objects
- Load core files to the debugger
- Manage breakpoints
- Set data breakpoints
- Show tooltips for simple values
- Start and debug an external application
- Start debugging
- Start debugging from the command line
- Step through code

## Design UIs

Design UIs with either Qt Quick or Qt Widgets. Qt Creator integrates a visual editor, Qt Widgets Designer, for designing widget-based UIs in the Design mode. For Qt Quick UIs, use a separate visual editor, Qt Design Studio, or the Edit mode.

- Create pixmaps from SVG images
- Preview Qt Quick UIs on devices
- Preview a QML file on desktop
- Run QML files
- View images

## Develop for Devices

Install the toolchain for building applications for the targeted embedded or mobile platform on the computer, and use Qt Online Installer to install Qt libraries that are built for the platform. Then add a kit with the toolchain and the Qt version for the device's architecture. When possible, Qt Online Installer creates suitable kits for you. Connect the devices to the computer to run, debug, and analyze applications on them.

### Android

Install Qt for Android and Android tools, and connect Android devices to the computer.

- Create an Android Virtual Device (AVD)
- Debug on Android devices
- Manage AVDs
- Manage Android NDK packages
- Manage Android SDK packages
- Set up Android development environment

### Bare Metal

Run and debug applications on small Linux devices that are not supported by the remote Linux device plugin by using GDB or a hardware debugger.

- Add Bare Metal devices
- Set up EBlink
- Set up J-Link
- Set up OpenOCD
- Set up St-Link
- Set up the uVision IDE

### Boot to Qt

Run, debug, and analyze applications on Boot to Qt devices.

- Add Boot to Qt devices
- Connect Boot to Qt devices
- Debug remotely with GDB

### Docker

Create Docker devices from Docker images and use them to build, run, and debug applications.

- Add Docker devices
- Build for and run on Docker devices
- Build on Docker devices
- Set preferences for Docker devices

### iOS

Install Qt for iOS and Xcode, and connect iOS devices to the computer.

- Connect iOS devices
- Test on iOS Simulator

### MCUs

Install Qt for MCUs, and connect microcontrollers to the computer.

- Add MCU SDKs
- Add MCU devices
- Create MCU projects
- Manage MCU Kits

### QNX Neutrino

Install Qt for QNX, and connect QNX Neutrino devices to the computer.

- Add a QNX Neutrino device
- Create kits for QNX Neutrino devices
- Debug remotely with GDB
- Run on QNX devices

### Remote Linux

Add kits for toolchains for building applications for generic Linux devices, and connect the devices to the computer.

- Add remote Linux devices
- Build applications on remote Linux devices
- Configure SSH connections
- Connect remote Linux devices
- Debug remotely with GDB
- Generate SSH keys
- Manage device processes
- Run on remote Linux devices

### SDKs

Manage SDKs for application development for different platforms.

- Add MCU SDKs
- Create kits for QNX Neutrino devices
- Manage Android NDK packages
- Manage Android SDK packages
- Manage Windows App SDK packages

### VxWorks

Build Qt for VxWorks, and create VxWorks build and run kits.

- Create kits for VxWorks devices
- Debug C++ applications on VxWorks devices

### WebAssembly

Install Qt for WebAssembly to build applications for the web and run them in a web browser.

- Build applications for the Web
- Run applications in a web browser

## Edit Code

The code editor offers useful features for editing C++ and QML code, such as semantic highlighting, checking code syntax, code completion, and quick fixes. Some of these features are also for other programming languages, such as Python, for which a language server is available that provides information about the code to IDEs.

- Apply quick fixes
- Automatically format QML/JS files
- Bookmark code
- Compare files
- Complete code
- Create Lua scripts
- Document code
- Download highlight definitions
- Edit Markdown files
- Edit properties of QML types
- Enclose code in brackets or quotes
- Highlight code blocks
- Indent text or code
- Insert multiple cursors
- Inspect the code model
- Locate files using the keyboard
- Move between files
- Move in QML code
- Move to symbols
- Parse files
- Paste and fetch code snippets
- Paste text from clipboard history
- Perform calculations
- Record text editing macros
- Select the current code block
- Specify Qt Quick code style
- Split the editor view
- Switch to Edit mode
- Use GitHub Copilot
- Use Qt AI Assistant
- Write down notes

### Configure Editors

Configure the code and text editor to suit your specific needs by changing the fonts, colors, highlighting, and indentation.

- Add code snippets to the auto-complete menu
- Beautify source code
- Change editor colors
- Change text encoding
- Configure C++ code model
- Edit MIME types
- Edit like in Vim
- Select line ending style
- Specify code style

### Manage Language Servers

Configure language servers that Qt Creator adds by default or add more of them.

- Add a Java language server
- Add generic language servers
- Configure Python language servers
- Configure QML Language Server
- Configure language servers for projects
- Inspect language clients

### Search

Use the incremental and advanced search to search in currently open projects or files on the file system or use the locator to browse through projects, files, classes, functions, documentation, and file systems.

- Find symbols
- Navigate with locator
- Rename symbols
- Search and replace using a regular expression
- Search in current file
- Search in projects or file systems
- Turn on Silver Searcher

## Manage Kits

Qt Creator groups build and run specific settings as kits to make cross-platform development easier. Each kit consists of a set of values that define one environment, such as a device, toolchain, Qt version, and debugger command to use.

- Activate kits for a project
- Add Bare Metal devices
- Add CMake tools
- Add Nim compilers
- Add Qt versions
- Add compilers
- Add custom compilers
- Add debuggers
- Add kits
- Create kits for QNX Neutrino devices
- Manage MCU Kits
- Open projects

## Manage Projects

Create projects for developing applications and libraries. Then configure the projects for building and running the applications on target platforms.

- Add libraries to CMake projects
- Configure projects for building
- Configure projects for running
- Create vcpkg manifest files
- Develop Qt for Python applications
- Edit environment settings
- Enable debugging
- Import an existing project
- Open projects
- Run Python applications
- Specify the environment for projects
- Use Qt Creator variables

### Create Projects

Use preset wizards to create projects or add custom wizards. You can also import projects from version control systems.

- Add libraries to qmake projects
- Add subprojects to projects
- Add wizards
- Create Nimble projects
- Create Qt Quick Applications
- Create Qt Quick UI Prototypes
- Create VCS repositories for new projects
- Select the build system
- Use project wizards

### Add Files

Add files to projects.

- Add a license header template for C++ code
- Add translation files
- Add wizards
- Create C++ classes
- Create OpenGL fragment and vertex shaders
- Create files
- Create resource files
- Set C++ file naming preferences

### Configure Projects

Change the default configurations that installation programs and project wizards create.

- Activate kits for a project
- Apply filters before scanning for tests
- Configure C++ code model
- Configure language servers for projects
- Create VCS repositories for new projects
- Exclude files from to-do lists
- Link projects with GitLab
- Open projects
- Override CMake settings for a project
- Share project settings
- Specify Clang tools settings
- Specify clangd settings
- Specify dependencies
- Specify editor settings
- Specify project contents
- Specify settings for quick fixes

## Read Documentation

Qt Creator integrates the reference documentation for the Qt versions that you install. You can add documentation from other sources.

- Add bookmarks to help pages
- Add external documentation
- Detach the help window
- Filter documentation
- Find information in Qt documentation
- Get help
- Read CMake documentation
- Search from documentation
- Select the help start page

## Test

Create and run code based tests and build system based tests. Code based testing offers special handling for particular testing frameworks that strongly ties to the underlying code models or specialized parsers. Build system based testing is independent from any testing frameworks. It retrieves information directly from the underlying build system and uses it or even the build system as such to execute the respective tests.

- Add tests to existing test projects
- Apply filters before scanning for tests
- Build and run tests
- Connect to Squish Server
- Create Boost tests
- Create CTest Based Tests
- Create Catch2 tests
- Create Google tests
- Create Qt Quick tests
- Create Qt tests
- Create Squish test suites
- Manage Squish test suites and cases
- Select Squish AUTs

## Use Git

Git is a fast decentralized version control system that is available for Windows, Linux, and macOS. You can use the Gerrit Code Review tool for projects that use Git.

- Commit your first change
- Create VCS repositories for new projects
- Git Tools
- Initialize Git repositories
- Set up version control systems
- Use Git for Windows
- Use Git with Subversion
- Use common VCS functions

### Current file

- Show instant blame
- Stage changes
- git blame
- git diff
- git log
- git reset

### Current project

- Stage changes
- git clean
- git diff
- git log

### Local repositories

- Apply patches
- Interactive rebase
- git am
- git branch
- git clean
- git commit
- git diff
- git log
- git merge
- git reflog
- git reset
- git stash
- git status

### Commits

- Apply actions to commits

### Remote repositories

- Review code with Gerrit
- git fetch
- git pull
- git push

## Use Qt Creator

Use basic Qt Creator features and preinstalled plugins. Install more plugins and configure external tools for use.

- Collect usage statistics
- Contact Qt
- Enable and disable plugins
- Inspect internal logs
- Install extensions
- Install plugins
- Load extensions
- Manage extensions
- Manage sessions
- Record screens
- Reset Qt Creator settings
- Run Qt Creator from the command line
- Set up version control systems
- Turn on crash reports
- Use Qt Linguist
- Use common VCS functions
- Use external text editors
- Use external tools

## Use the UI

Navigate the UI or change its appearance and behavior.

- Assign keyboard shortcuts
- Change the UI language
- Detach views
- Find keyboard shortcuts
- Find preferences
- Set high DPI scaling
- Set the number of recent files shown
- Show and hide sidebars
- Show and hide the main menu
- Show task list files in issues
- Switch UI themes
- Switch between modes
- View output