How to | Qt Creator Documentation

- Qt Creator Documentation
- How to
- Qt Creator 19.0.0

Tutorial: Use internal libraries with qmake ◦ Adapting the UI

# How to

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

## Adapt the UI

> Adapting the UI

Navigate the Qt Creator UI or change its appearance and behavior.

How to adapt the UI

- Assign keyboard shortcuts
- Change the UI language
- Detach views
- Find keyboard shortcuts
- Find preferences
- Import and export keyboard shortcuts
- Preview images
- 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
- Use info bars instead of pop-ups
- View Squish output
- View application output
- View call hierarchy
- View class hierarchy
- View compile output
- View file system
- View include hierarchy
- View issues
- View open documents
- View outline
- View output
- View projects
- View search results
- View type hierarchy

## Analyze

> Analyzing code

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.

How to analyze code

- Analyze CPU usage
- Analyze code with Clang-Tidy and Clazy
- Check code syntax
- Configure Clang diagnostics
- Connect to Axivion dashboard servers
- 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 global preferences for Clang tools
- 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

> Building and running projects

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.

How to build and run applications

- Activate custom output parsers
- Add custom output parsers
- Build for many platforms
- Configure development tools
- Configure projects for building
- Customize the build process
- Edit Qbs profiles
- Edit vcpkg manifest files
- Enable debugging
- Parse build output
- Set Qbs profile directory
- Set the default build and run directories
- Set up vcpkg package manager
- Use Development Containers
- Use MCP client
- Use compilation databases
- View compile output

### Build with CMake

> Building projects with CMake

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

How to build with CMake

- 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
- Use junction points on Windows
- View CMake project contents

### Build with qmake

> Building projects with qmake

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

How to build with qmake

- Add libraries to qmake projects
- Run qmake before building

### Manage kits

> Managing 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.

How to manage kits

- 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
- Set compiler preferences

### Run projects

> Running applications

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

How to run applications

- Configure projects for running
- Run Python applications
- Run in Qt Application Manager
- Run on QNX devices
- Run on remote Linux devices
- Run on the desktop
- Set the default build and run directories
- Specify Qt Quick UI Prototype run settings
- Specify a custom executable to run
- Use MCP client
- View application output

## Configure Qt Creator

> Configuring Qt Creator

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

How to configure Qt Creator

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

## Create projects

> Creating projects

Create projects for developing applications and libraries using preset wizards or your own wizards. Then configure the projects for building and running the applications on target platforms.

How to create projects

- Add libraries to qmake projects
- Add subprojects to projects
- Add wizards
- Convert UI projects to applications
- Create Nimble projects
- Create Qt Interface Framework projects
- Create Qt Quick Applications
- Create Qt Quick UI Prototypes
- Create VCS repositories for new projects
- Develop Qt for Python applications
- Import an existing project
- Select the build system
- Use project wizards

### Add files

> Adding files

Add files to projects.

How to 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 resource files
- Create vcpkg manifest files
- Set C++ file naming preferences

### Configure projects

> Configuring projects locally

Change the default configurations that installation programs and project wizards create and override global preferences for a particular project.

How to configure projects

- Activate kits for a project
- Apply filters before scanning for tests
- Configure C++ code model
- Configure language servers for projects
- Configure projects for building
- Configure projects for running
- Edit environment settings
- Enable debugging
- 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 build and run settings
- Specify clangd settings
- Specify dependencies
- Specify editor settings
- Specify project contents
- Specify settings for quick fixes
- Specify the environment for projects
- Use Qt Creator variables

## Debug

> Debugging

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

How to debug applications

- 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
- Use MCP client

## Design UIs

> Designing UIs

Design UIs with either Qt Quick or Qt Widgets using integrated visual editors in the Design mode.

How to design UIs

- Create pixmaps from SVG images
- Preview images
- View images

### Design Qt Quick UIs

> Designing Qt Quick UIs

Qt Creator automatically opens UI forms (`.ui.qml`) files in the integrated Qt Quick Designer, in Design mode.

How to design Qt Quick UIs

- Add assets
- Annotate designs
- Convert UI projects to applications
- Create Qt Quick Applications
- Create Qt Quick UI Prototypes
- Design 2D UIs
- Load placeholder data
- Navigate component files
- Open UI files in Qt Design Studio
- Preview Qt Quick UIs on devices
- Preview a QML file on desktop
- Run QML files
- Specify Qt Quick UI Prototype run settings
- Use custom fonts
- Use workspaces

#### Use UI components

> Using UI components

Import Qt QML modules to use instances of their QML types in applications.

How to use UI components

- Add bindings between properties
- Add custom properties
- Add interaction to UIs
- Add text to UIs
- Change properties
- Connect components to signals
- Create buttons
- Create component instances
- Create custom components
- Create scalable buttons and borders
- Create shapes
- Import modules
- Insert UI controls
- Make layouts scalable
- Pick colors
- Pick gradients
- Set advanced component properties
- Set basic component properties
- Use images in UIs
- Use lists and other data models
- Use preset components

#### Add animation

> Adding animation

Pick from a selection of animation techniques that are suitable for different purposes

How to animate UI components

- Add transitions between states
- Animate property changes
- Create timeline animations
- Edit animation curves
- Edit easing curves

#### Work with states

> Working with states

How to apply states

- Create a base state
- Set the default state
- Set when conditions

### Design widget-based UIs

> Designing widget-based UIs

Qt Creator automatically opens all `.ui` files in the integrated Qt Widgets Designer, in Design mode.

How to design widget-based UIs

- Add Qt Widgets Designer Plugins

## Develop for devices

> Developing 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

> Developing for Android

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

How to to develop for Android

- Add external libraries to Android packages
- Create Android packages
- Create an Android Virtual Device (AVD)
- Debug on Android devices
- Deploy applications to Android
- Edit Android manifest files
- Manage AVDs
- Manage Android NDK packages
- Manage Android SDK packages
- Set up Android development environment
- Sign Android packages
- Specify Android run settings

### Bare Metal

> Developing for Bare Metal devices

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.

How to develop for bare metal devices

- 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

> Developing for Boot to Qt devices

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

How to develop for Boot to Qt devices

- Add Boot to Qt devices
- Connect Boot to Qt devices
- Copy application files to Boot to Qt devices
- Debug remotely with GDB
- Deploy applications to remote Linux devices
- Run on Boot to Qt devices

### Docker

> Developing for Docker

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

How to develop for Docker devices

- Add Docker devices
- Build for and run on Docker devices
- Build on Docker devices
- Configure development tools
- Set preferences for Docker devices
- Use Development Containers

### iOS

> Developing for iOS

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

How to develop for iOS devices

- Connect iOS devices
- Test on iOS Simulator

### MCUs

> Developing for MCUs

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

How to develop for microcontrollers

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

### QNX Neutrino

> Developing for QNX Neutrino devices

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

How to develop for QNX Neutrino devices

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

### Remote Linux

> Developing for remote Linux devices

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

How to develop for remote Linux devices

- Add remote Linux devices
- Build applications on remote Linux devices
- Configure SSH connections
- Configure development tools
- Connect remote Linux devices
- Debug remotely with GDB
- Deploy applications to remote Linux devices
- Generate SSH keys
- Manage device processes
- Run on remote Linux devices
- Specify remote Linux run settings

### VxWorks

> Developing for VxWorks

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

How to build application for VxWorks

- Create SSH connections to VxWorks devices
- Create kits for VxWorks devices
- Debug C++ applications on VxWorks devices

### WebAssembly

> Building applications for the web

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

How to build application for the web

- Run applications in a web browser
- Set up WebAssembly development environment

### Windows desktop

> Developing for the Windows desktop

Develop applications using the components and tools of the Windows App SDK.

How to develop for Windows desktop

- Manage Windows App SDK packages

## Edit code

> Editing 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.

How to edit code

- Add to-do keywords
- 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
- Preview images
- 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

> Configuring editors

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

How to configure editors

- 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

> Managing language servers

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

How to manage language servers

- 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

> Searching

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.

How to search

- Configure the locator
- 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
- View search results

## Edit state charts

> Editing SCXML state charts

Use a file wizard to create State Chart XML (SCXML) files with boilerplate code and edit them with an SCXML editor.

How to edit state charts

- Create state charts

## Edit UML-style models

> Editing UML-style models

Create Universal Modeling Language (UML) style models with structured and behavioral diagrams that offer different views to your system.

How to edit models and diagrams

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

## Read documentation

> Getting help

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

How to get help

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

## Test

> Testing

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.

How to test applications

- 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
- View Squish output
- View test results

## Use Git

> Using 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.

How to use Git

- Apply actions to commits
- Commit your first change
- Create VCS repositories for new projects
- Create and apply patches
- Git Tools
- Initialize Git repositories
- Interactive rebase
- Review code with Gerrit
- Set up version control systems
- Show instant blame
- Stage changes
- Use Git for Windows
- Use Git with Subversion
- Use common VCS functions
- git am
- git blame
- git branch
- git clean
- git commit
- git diff
- git fetch
- git log
- git merge
- git pull
- git push
- git reflog
- git reset
- git stash
- git status

### Current file

How to handle changes in the current file

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

### Current project

How to handle changes in the current project

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

### Local repositories

How to manage local repositories

- Create and 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

How to handle commits

- Apply actions to commits

### Remote repositories

How to manage remote repositories

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

Tutorial: Use internal libraries with qmake ◦ Adapting the UI