Qt Creator is the Qt framework’s default built-in growth setting (IDE) and therefore the glue between Qt’s wealthy set of libraries and the consumer. In addition to its fundamental options comparable to clever code completion, debugging, and challenge administration, Qt Creator gives numerous good options that make software program growth simpler.
In this text, I’ll spotlight a few of my favourite Qt Creator options.
Dark mode
My first query when working with a brand new software is: Is there a darkish mode? Qt Creator solutions with: Which darkish mode do you favor?
You can activate darkish mode within the Options menu. On the highest menu bar, go to Tools, choose Options, and go to the Environment part. Here is the place you’ll be able to choose the overall look:
Custom look
Like each Qt software, Qt Creator’s look is extremely customizable with fashion sheets. Below, you’ll be able to comply with together with my strategy to provide Qt Creator a flowery look.
Create the file mycustomstylesheet.css
with the next content material:
QMenuBar
QMenuBar::merchandise
QMenu background-color : beige; coloration : black
QLabel
Then begin Qt Creator from the command line and cross the fashion sheet as a parameter with:
qtcreator -stylesheet=mycustomstylesheet.css
It ought to appear like this:
Read extra about fashion sheets within the documentation.
Command-line parameters
Qt Creator accepts many command-line choices. For instance, if you wish to robotically load your present challenge at startup, cross the trail to the *.pro-file
:
qtcreator ~/MyProject/MyQtProject.professional
You may even cross the file and the road quantity that must be opened by default. This command opens the file foremost.cpp
at line 20:
qtcreator ~/MyProject/foremost.cpp:20
Read extra in regards to the Qt Creator-specific command-line choices within the documentation.
Qt Creator is an abnormal Qt software, so, along with its personal command-line arguments, it additionally accepts the generic arguments for QApplication and QGuiApplication.
Cross-compiling
Qt Creator lets you outline a number of toolchains, referred to as Kits. A equipment defines the binaries and SDK for constructing and operating an software:
This lets you swap between fully completely different toolchains with simply two clicks:
Read extra about kits within the manual.
Analyzer
Qt Creator integrates a number of of the most well-liked analyzers, comparable to:
Debugger
When it involves debugging, Qt Creator has a pleasant interface for GNU Debugger (GDB). I like its straightforward method of inspecting container sorts and creating conditional breakpoints:
PretendVim
If you want Vim, allow PretendVim within the settings to regulate Qt Creator like Vim. Go to Tools and choose Options. In the PretendVim part, you’ll find many switches to customise PretendVim’s habits. In addition to the editor features, you may as well map your personal features to customized Vim instructions.
For instance, you’ll be able to map the perform Build Project to the construct
command:
Back within the editor, whenever you press the colon button and enter construct
, Qt Creator begins a construct course of with the configured toolchain:
You can discover extra details about PretendVim in the docs.
Class inspector
When growing in C++, open the proper window by clicking on the button within the bottom-right nook of Qt Creator. Then select Outline from the dropdown menu on the highest border. If you could have a header file open on the left pane, you get a pleasant overview of the outlined lessons or sorts. If you turn to a supply file (*.cpp
), the proper pane will record all outlined strategies, and you’ll bounce to 1 by double-clicking on it:
Project configuration
Qt Creator tasks are constructed across the *.pro-file
within the challenge’s listing. You can add your personal customized configuration to the challenge’s *.pro-file
of your challenge. I added my_special_config
to the *.pro-file
, which provides MY_SPECIAL_CONFIG
to the compiler outlined:
QT -= guiCONFIG += c++11 console
CONFIG -= app_bundleCONFIG += my_special_config
my_special_config
DEFINES += MY_SPECIAL_CONFIG
Qt Creator robotically highlights the code in accordance with the energetic configuration:
The *.pro-file
is written within the qmake language.
Summary
These options are solely the tip of the iceberg of what Qt Creator gives. Beginners should not really feel overwhelmed by the various options, as Qt Creator is totally beginner-friendly. It might even be the simplest option to begin growing in C++. To get an entire overview of its options, check with the official Qt Creator documentation.