summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-08-07 11:31:16 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-08-17 18:08:04 +0200
commit5fbb714cc12ced4e36d7af70e883a68ad54817ac (patch)
tree672d289e101ca17b16cca8a3dd6fd89e07c4f992 /doc/src/snippets
parentdce23a8a51a57509c6bff07c11023a5b77d45e3f (diff)
Mark the module as free of Q_FOREACH, except where it isn't
The density of Q_FOREACH uses is moderate here, but too high for this author, unfamiliar with this code, to tackle in a short amount of time. But they're concentrated in just a few TUs, so pick a different strategy: Mark the whole module with QT_NO_FOREACH, to prevent new uses from creeping in, and whitelist the affected TUs by #undef'ing QT_NO_FOREACH locally, at the top of each file. For TUs that are part of a larger executable, this requires these files to be compiled separately, so add them to NO_PCH_SOURCES (which implies NO_UNITY_BUILD_SOURCES, too). NB: there are none such TUs in this module. Created QTBUG-115830 to keep track of this. Task-number: QTBUG-115830 Change-Id: I68c9394c04af68cab46480153a5601828565461a Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/code/src_corelib_kernel_qobject.cpp2
-rw-r--r--doc/src/snippets/qtablewidget-dnd/mainwindow.cpp2
-rw-r--r--doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp2
-rw-r--r--doc/src/snippets/webkit/imageanalyzer/imageanalyzer.cpp2
-rw-r--r--doc/src/snippets/webkit/simpleselector/window.cpp2
5 files changed, 10 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp
index 0e173d444..4e1510c22 100644
--- a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp
+++ b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp
@@ -1,6 +1,8 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
+
//! [0]
QLineEdit *lineEdit = static_cast<QLineEdit *>(
qt_find_obj_child(myWidget, "QLineEdit", "my line edit"));
diff --git a/doc/src/snippets/qtablewidget-dnd/mainwindow.cpp b/doc/src/snippets/qtablewidget-dnd/mainwindow.cpp
index 3e3111ba8..75b0bc651 100644
--- a/doc/src/snippets/qtablewidget-dnd/mainwindow.cpp
+++ b/doc/src/snippets/qtablewidget-dnd/mainwindow.cpp
@@ -1,6 +1,8 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
+
#include <QtGui>
#include "math.h"
diff --git a/doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp b/doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp
index f621ff97b..a24454443 100644
--- a/doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp
+++ b/doc/src/snippets/qtreeview-dnd/dragdropmodel.cpp
@@ -1,6 +1,8 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
+
#include <QtGui>
#include "dragdropmodel.h"
diff --git a/doc/src/snippets/webkit/imageanalyzer/imageanalyzer.cpp b/doc/src/snippets/webkit/imageanalyzer/imageanalyzer.cpp
index bee5e9e48..42324c1d6 100644
--- a/doc/src/snippets/webkit/imageanalyzer/imageanalyzer.cpp
+++ b/doc/src/snippets/webkit/imageanalyzer/imageanalyzer.cpp
@@ -2,6 +2,8 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
+
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QNetworkAccessManager>
diff --git a/doc/src/snippets/webkit/simpleselector/window.cpp b/doc/src/snippets/webkit/simpleselector/window.cpp
index 6c3156b6e..67a0681fc 100644
--- a/doc/src/snippets/webkit/simpleselector/window.cpp
+++ b/doc/src/snippets/webkit/simpleselector/window.cpp
@@ -1,6 +1,8 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
+
#include <QWebElement>
#include <QWebFrame>
#include "window.h"