
Application Development with Qt Creator - Second Edition

All the material we cover in this chapter depends on the Qt GUI module, available as part of Qt. Even if you're writing a command-line tool (say, to process image files), you need to include that module in your project by adding the following to your .pro
file:
QT += gui widgets
Of course, in your C++ implementation, we also need to include the header files for the classes we're using. For example, if we're using QImage
, QBitmap
, and QPainter
, be sure to include these headers at the top of your C++ file like this:
#include <QImage> #include <QPainter> #include <QBitmap>
As Qt's painting implementation uses the underlying windowing system, any application that performs graphics operation must be built using QGuiApplication
, which initializes the windowing system as part of its startup.