diff --git a/.qmake.conf b/.qmake.conf index 08e1a4723c..5c64c10981 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,6 +1,8 @@ load(qt_build_config) CONFIG += warning_clean +DEFINES += QT_NO_JAVA_STYLE_ITERATORS + QT_SOURCE_TREE = $$PWD QT_BUILD_TREE = $$shadowed($$PWD) diff --git a/src/corelib/tools/qbytearraylist.h b/src/corelib/tools/qbytearraylist.h index 1261e1757c..0250b649b8 100644 --- a/src/corelib/tools/qbytearraylist.h +++ b/src/corelib/tools/qbytearraylist.h @@ -48,8 +48,11 @@ QT_BEGIN_NAMESPACE +#if !defined(QT_NO_JAVA_STYLE_ITERATORS) typedef QListIterator QByteArrayListIterator; typedef QMutableListIterator QMutableByteArrayListIterator; +#endif + #ifndef Q_CLANG_QDOC typedef QList QByteArrayList; diff --git a/src/corelib/tools/qiterator.h b/src/corelib/tools/qiterator.h index 449d1049a0..84a0e116ca 100644 --- a/src/corelib/tools/qiterator.h +++ b/src/corelib/tools/qiterator.h @@ -44,6 +44,8 @@ QT_BEGIN_NAMESPACE +#if !defined(QT_NO_JAVA_STYLE_ITERATORS) + #define Q_DECLARE_SEQUENTIAL_ITERATOR(C) \ \ template \ @@ -179,6 +181,13 @@ public: \ n = c->end(); return false; } \ }; +#else // QT_NO_JAVA_STYLE_ITERATORS +#define Q_DECLARE_SEQUENTIAL_ITERATOR(C) +#define Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(C) +#define Q_DECLARE_ASSOCIATIVE_ITERATOR(C) +#define Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(C) +#endif // QT_NO_JAVA_STYLE_ITERATORS + template class QKeyValueIterator { diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h index 98caabfb57..19d6982133 100644 --- a/src/corelib/tools/qset.h +++ b/src/corelib/tools/qset.h @@ -402,6 +402,7 @@ QList QList::fromSet(const QSet &set) Q_DECLARE_SEQUENTIAL_ITERATOR(Set) +#if !defined(QT_NO_JAVA_STYLE_ITERATORS) template class QMutableSetIterator { @@ -433,6 +434,7 @@ public: { while (c->constBegin() != i) if (*(n = --i) == t) return true; n = c->end(); return false; } }; +#endif // QT_NO_JAVA_STYLE_ITERATORS QT_END_NAMESPACE diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index 45f51bfcc6..a464d443dc 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -54,8 +54,10 @@ QT_BEGIN_NAMESPACE class QRegExp; class QRegularExpression; +#if !defined(QT_NO_JAVA_STYLE_ITERATORS) typedef QListIterator QStringListIterator; typedef QMutableListIterator QMutableStringListIterator; +#endif class QStringList; diff --git a/tests/auto/corelib/thread/qfuture/qfuture.pro b/tests/auto/corelib/thread/qfuture/qfuture.pro index b1667760d6..1f21130af7 100644 --- a/tests/auto/corelib/thread/qfuture/qfuture.pro +++ b/tests/auto/corelib/thread/qfuture/qfuture.pro @@ -3,3 +3,4 @@ TARGET = tst_qfuture QT = core core-private testlib SOURCES = tst_qfuture.cpp DEFINES += QT_STRICT_ITERATORS +DEFINES -= QT_NO_JAVA_STYLE_ITERATORS diff --git a/tests/auto/corelib/tools/collections/collections.pro b/tests/auto/corelib/tools/collections/collections.pro index 5c04515fa0..b074fa9338 100644 --- a/tests/auto/corelib/tools/collections/collections.pro +++ b/tests/auto/corelib/tools/collections/collections.pro @@ -5,3 +5,4 @@ QT = core testlib # This test does not work with strict iterators DEFINES -= QT_STRICT_ITERATORS +DEFINES -= QT_NO_JAVA_STYLE_ITERATORS diff --git a/tests/auto/corelib/tools/qhash/qhash.pro b/tests/auto/corelib/tools/qhash/qhash.pro index 79ffd4e9d1..e96c0d1bf1 100644 --- a/tests/auto/corelib/tools/qhash/qhash.pro +++ b/tests/auto/corelib/tools/qhash/qhash.pro @@ -2,3 +2,5 @@ CONFIG += testcase TARGET = tst_qhash QT = core testlib SOURCES = $$PWD/tst_qhash.cpp + +DEFINES -= QT_NO_JAVA_STYLE_ITERATORS diff --git a/tests/auto/corelib/tools/qmap/qmap.pro b/tests/auto/corelib/tools/qmap/qmap.pro index 27820a76c8..2cc772720d 100644 --- a/tests/auto/corelib/tools/qmap/qmap.pro +++ b/tests/auto/corelib/tools/qmap/qmap.pro @@ -2,3 +2,5 @@ CONFIG += testcase TARGET = tst_qmap QT = core testlib SOURCES = $$PWD/tst_qmap.cpp + +DEFINES -= QT_NO_JAVA_STYLE_ITERATORS diff --git a/tests/auto/corelib/tools/qset/qset.pro b/tests/auto/corelib/tools/qset/qset.pro index 10ae3307d1..d0c6337147 100644 --- a/tests/auto/corelib/tools/qset/qset.pro +++ b/tests/auto/corelib/tools/qset/qset.pro @@ -2,3 +2,5 @@ CONFIG += testcase TARGET = tst_qset QT = core testlib SOURCES = tst_qset.cpp + +DEFINES -= QT_NO_JAVA_STYLE_ITERATORS