9 reasons I love to use the Qt Creator IDE | Opensource.com

9 reasons I love to use the Qt Creator IDE

Qt Creator is the glue between Qt's rich set of libraries and the programmer.

Business woman on laptop sitting in front of window
Image credits : 

Image by Mapbox Uncharted ERG, CC-BY 3.0 US

x

Subscribe now

Get the highlights in your inbox every week.

Qt Creator is the Qt framework's default integrated development environment (IDE) and hence the glue between Qt's rich set of libraries and the user. In addition to its basic features such as intelligent code completion, debugging, and project administration, Qt Creator offers a lot of nice features that make software development easier.

In this article, I will highlight some of my favorite Qt Creator features.

Dark mode

My first question when working with a new application is: Is there a dark mode? Qt Creator answers with: Which dark mode do you prefer?

You can activate dark mode in the Options menu. On the top menu bar, go to Tools, select Options, and go to the Environment section. Here is where you can select the general appearance:

qt_creator_dark_mode.png

 QT Creator dark mode

(Stephan Avenwedde, CC BY-SA 4.0)

Custom appearance

Like every Qt application, Qt Creator's appearance is highly customizable with style sheets. Below, you can follow along with my approach to give Qt Creator a fancy look.

Create the file mycustomstylesheet.css with the following content:

QMenuBar { background-color: olive }
QMenuBar::item { background-color: olive }
QMenu { background-color : beige; color : black }
QLabel { color: green }

Then start Qt Creator from the command line and pass the style sheet as a parameter with:

qtcreator -stylesheet=mycustomstylesheet.css

It should look like this:

Read more about style sheets in the documentation.

Command-line parameters

Qt Creator accepts many command-line options. For example, if you want to automatically load your current project at startup, pass the path to the *.pro-file:

qtcreator ~/MyProject/MyQtProject.pro

You can even pass the file and the line number that should be opened by default. This command opens the file main.cpp at line 20:

qtcreator ~/MyProject/main.cpp:20

Read more about the Qt Creator-specific command-line options in the documentation.

Qt Creator is an ordinary Qt application, so, in addition to its own command-line arguments, it also accepts the generic arguments for QApplication and QGuiApplication.

Cross-compiling

Qt Creator allows you to define several toolchains, called Kits. A kit defines the binaries and SDK for building and running an application:

This allows you to switch between completely different toolchains with just two clicks:

Read more about kits in the manual.

Analyzer

Qt Creator integrates several of the most popular analyzers, such as:

qt_creator_analyzer.png

Qt Creator analyzer

(Stephan Avenwedde, CC BY-SA 4.0)

Debugger

When it comes to debugging, Qt Creator has a nice interface for GNU Debugger (GDB). I like its easy way of inspecting container types and creating conditional breakpoints:

qt_creator_debugger2.png

Qt Creator debugger

(Stephan Avenwedde, CC BY-SA 4.0)

FakeVim

If you like Vim, enable FakeVim in the settings to control Qt Creator like Vim. Go to Tools and select Options. In the FakeVim section, you can find many switches to customize FakeVim's behavior. In addition to the editor functions, you can also map your own functions to custom Vim commands.

For example, you can map the function Build Project to the build command:

Back in the editor, when you press the colon button and enter build, Qt Creator starts a build process with the configured toolchain:

You can find more information about FakeVim in the docs.

Class inspector

When developing in C++, open the right window by clicking on the button in the bottom-right corner of Qt Creator. Then choose Outline from the dropdown menu on the top border. If you have a header file open on the left pane, you get a nice overview of the defined classes or types. If you switch to a source file (*.cpp), the right pane will list all defined methods, and you can jump to one by double-clicking on it:

Project configuration

Qt Creator projects are built around the *.pro-file in the project's directory. You can add your own custom configuration to the project's *.pro-file of your project. I added my_special_config to the *.pro-file, which adds MY_SPECIAL_CONFIG to the compiler defined:

QT -= gui

CONFIG += c++11 console
CONFIG -= app_bundle

CONFIG += my_special_config

my_special_config {
DEFINES += MY_SPECIAL_CONFIG
}

Qt Creator automatically highlights the code according to the active configuration:

The *.pro-file is written in the qmake language.

Summary

These features are only the tip of the iceberg of what Qt Creator provides. Beginners shouldn't feel overwhelmed by the many features, as Qt Creator is absolutely beginner-friendly. It may even be the easiest way to start developing in C++. To get a complete overview of its features, refer to the official Qt Creator documentation.

Programming keyboard.

When it comes to Python programming, you have many options for great integrated development environments.

Topics

About the author

Stephan Avenwedde - Stephan is a technology enthusiast who appreciates open source for the deep insight of how things work. Stephan works as a full time support engineer in the mostly proprietary area of industrial automation software. If possible, he works on his Python-based open source projects, writing articles, or driving motorbike.