summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qvariant.h
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2022-02-06 20:09:54 +0100
committerThiago Macieira <thiago.macieira@intel.com>2022-03-17 16:14:38 +0000
commitfb0c7a9956824fbc3e3a3ab70cf7e2e5a622e85d (patch)
treedbb1d5fa0d1eca6ae616fc94afa17a3d00848d9b /src/corelib/kernel/qvariant.h
parent91a50d8330bb1b9a6aa1ae3e5e5baf110d26a804 (diff)
QVariant: reduce transitive includes
Forward declare more types in qvariant.h, and do the same for qdebug.h (which will be removed from qvariant in a separate patch). As we now only forward declare containers (e.g. QMap, QList, ...), code which includes <QVariantMap>, <QVariantList>... breaks without further adjustment: So far, those headers simply included qvariant.h. However, by introducing new actual headers for those types and adjusting sync.profile, we can avoid this issue. To avoid breaking leaf modules and user code, we make the change opt-in: Unless QT_LEAN_HEADERS is defined to a value of >= 1, we still include the superfluous headers. We also set this macro in qtbase via QT_EXTRA_INTERNAL_TARGET_DEFINES. [ChangeLog][Potentially Source-Incompatible Changes] qvariant.h no longer includes <QList>, <QMap>, <QHash>, <QVarLengthArray>, <QSet> and <QObject>. Code that relied on transitive includes might need to explicitly include those headers now. Notably, including <QVariant> (or qvariant.h) is no longer sufficient when using QVariant(List|Map|Hash). Using them now requires including respectively <QVariantList>, <QVariantMap>, or <QVariantHash>. Alternatively, including <QVariant> and the <QList>, <QMap> or <QHash> header also works. [ChangeLog][Potentially Source-Incompatible Changes] qdebug.h no longer includes <QSet>, <QHash>, <QVarLengthArray> and <QMap>. Code that relied on transitive includes might need to explicitly include those headers now. Task-number: QTBUG-97601 Change-Id: I142e5de709ed0b305716369a3266389ab7fbbb71 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/kernel/qvariant.h')
-rw-r--r--src/corelib/kernel/qvariant.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index fc6b8e9563..ffc091ebf9 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -41,23 +41,22 @@
#define QVARIANT_H
#include <QtCore/qatomic.h>
-#include <QtCore/qbytearray.h>
-#include <QtCore/qlist.h>
+#include <QtCore/qcontainerfwd.h>
#include <QtCore/qmetatype.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qhash.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qobject.h>
#ifndef QT_NO_DEBUG_STREAM
#include <QtCore/qdebug.h>
#endif
-#ifndef QT_BOOTSTRAPPED
-#include <QtCore/qbytearraylist.h>
-#endif
#include <memory>
#include <type_traits>
#include <variant>
+#if !defined(QT_LEAN_HEADERS) || QT_LEAN_HEADERS < 1
+# include <QtCore/qlist.h>
+# include <QtCore/qstringlist.h>
+# include <QtCore/qbytearraylist.h>
+# include <QtCore/qhash.h>
+# include <QtCore/qmap.h>
+# include <QtCore/qobject.h>
+#endif
QT_BEGIN_NAMESPACE