QtCore/QtDBus/QtSql: port the last remaining Q_FOREACH loop and add QT_NO_FOREACH

Port the last remaining Q_FOREACH user in QtCore to
C++11 range-for and mark QtCore, QtSql and QtDBus as
Q_FOREACH-free, using QT_NO_FOREACH.

Change-Id: Ia6f99139cb1ca4a8bbe9e445421592242e048b0a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Marc Mutz 2016-05-11 11:53:02 +02:00
parent f0d7080e9e
commit e2e0dfee7c
4 changed files with 9 additions and 3 deletions

View File

@ -8,7 +8,7 @@ MODULE_CONFIG = moc resources
CONFIG += $$MODULE_CONFIG
DEFINES += $$MODULE_DEFINES
DEFINES += QT_NO_USING_NAMESPACE
DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused

View File

@ -1778,7 +1778,11 @@ void QStateMachinePrivate::_q_start()
{
Q_Q(QStateMachine);
Q_ASSERT(state == Starting);
foreach (QAbstractState *state, configuration) {
// iterate over a copy, since we emit signals which may cause
// 'configuration' to change, resulting in undefined behavior when
// iterating at the same time:
const auto config = configuration;
for (QAbstractState *state : config) {
QAbstractStatePrivate *abstractStatePrivate = QAbstractStatePrivate::get(state);
abstractStatePrivate->active = false;
emit state->activeChanged(false);

View File

@ -23,6 +23,8 @@ win32 {
-luser32
}
DEFINES += QT_NO_FOREACH
QMAKE_DOCS = $$PWD/doc/qtdbus.qdocconf
PUB_HEADERS = qdbusargument.h \

View File

@ -6,7 +6,7 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000
QMAKE_DOCS = $$PWD/doc/qtsql.qdocconf
DEFINES += QT_NO_CAST_FROM_ASCII
DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
SQL_P = sql