diff --git a/src/corelib/doc/src/foreach-keyword.qdoc b/src/corelib/doc/src/foreach-keyword.qdoc index e0109f1f0ce..6aa21d58805 100644 --- a/src/corelib/doc/src/foreach-keyword.qdoc +++ b/src/corelib/doc/src/foreach-keyword.qdoc @@ -73,4 +73,18 @@ \c foreach would not. But using \c foreach always copies the container, which is usually not cheap for STL containers. If in doubt, prefer \c foreach for Qt containers, and range based \c for for STL ones. + + You can remove the availability of the Qt's \c foreach loop by + defining the \c{QT_NO_FOREACH} macro. +*/ + +/*! + \macro QT_NO_FOREACH + \since 6.0 + \relates + + Defining this macro removes the availability of Qt's \c foreach + loop. + + \sa QT_NO_KEYWORDS */ diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index cddf446392e..304f4fb2e51 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -213,6 +213,19 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) return false; } +/*! + \macro QT_NO_KEYWORDS + \relates + + Define this macro to disable the Qt-specific keywords that are usually enabled, + such as \c signals and \c slots. Use \c Q_SIGNALS and \c Q_SLOTS instead. + + Libraries should define this macro to make sure that they don't use the generic + keywords without the \c Q_ prefix in their public headers. + + \sa QT_NO_FOREACH +*/ + /*! \macro QT_NAMESPACE \internal