Better_Software_Header_MobileBetter_Software_Header_Web

Find what you need - explore our website and developer resources

Beware of Qt Module-wide Includes

Save the planet by reducing compilation times!

#ifndef QT_QTQUICK_MODULE_H
#define QT_QTQUICK_MODULE_H
#include <QtQuick/QtQuickDepends>
#include "qtquickglobal.h"
#include "qquickframebufferobject.h"
#include "qquickimageprovider.h"
#include "qquickitem.h"
// .. many more includes
// ...
#include <QtCore/QtCore>
#include <QtGui/QtGui>
#include <QtQml/QtQml>
#include <QtQmlModels/QtQmlModels>
// ...
// !!! WRONG !!!
// This includes all QtTest headers, plus all of QtCore,
// plus other bits!
#include <QtTest>

// Same:
#include <QtTest/QtTest>
// Standalone:
#include <QTest>

// Same; if you prefer, with the module prefix:
#include <QtTest/QTest>

About KDAB


2 Comments

20 - Jan - 2021

kpop

21 - Jan - 2021

Giuseppe D'Angelo

GiuseppeD'Angelo

Giuseppe D’Angelo

Senior Software Engineer

Learn Modern C++

Learn more