summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf4
-rw-r--r--examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.cpp18
-rw-r--r--examples/quickcontrols/controls/texteditor/src/documenthandler.cpp3
-rw-r--r--src/controls/Private/qquickstyleitem.cpp2
-rw-r--r--tests/auto/qquicktreemodeladaptor/tst_qquicktreemodeladaptor.cpp16
-rw-r--r--tests/auto/shared/testmodel.h3
-rw-r--r--tests/benchmarks/objectcount/tst_objectcount.cpp4
7 files changed, 20 insertions, 30 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 9d2ecda2..eb6b6a3b 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -2,4 +2,6 @@ load(qt_build_config)
CONFIG += warning_clean
android|ios|qnx|isEmpty(QT.widgets.name): CONFIG += no_desktop
-MODULE_VERSION = 5.13.1
+DEFINES += QT_NO_FOREACH QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST
+
+MODULE_VERSION = 5.14.0
diff --git a/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.cpp b/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.cpp
index b93641a9..1e47f23e 100644
--- a/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.cpp
+++ b/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.cpp
@@ -132,11 +132,8 @@ QJSValue SortFilterProxyModel::get(int idx) const
QJSValue value = engine->newObject();
if (idx >= 0 && idx < count()) {
QHash<int, QByteArray> roles = roleNames();
- QHashIterator<int, QByteArray> it(roles);
- while (it.hasNext()) {
- it.next();
+ for (auto it = roles.cbegin(), end = roles.cend(); it != end; ++it)
value.setProperty(QString::fromUtf8(it.value()), data(index(idx, 0), it.key()).toString());
- }
}
return value;
}
@@ -156,14 +153,7 @@ void SortFilterProxyModel::componentComplete()
int SortFilterProxyModel::roleKey(const QByteArray &role) const
{
- QHash<int, QByteArray> roles = roleNames();
- QHashIterator<int, QByteArray> it(roles);
- while (it.hasNext()) {
- it.next();
- if (it.value() == role)
- return it.key();
- }
- return -1;
+ return roleNames().key(role, -1);
}
QHash<int, QByteArray> SortFilterProxyModel::roleNames() const
@@ -181,9 +171,7 @@ bool SortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &so
QAbstractItemModel *model = sourceModel();
if (filterRole().isEmpty()) {
QHash<int, QByteArray> roles = roleNames();
- QHashIterator<int, QByteArray> it(roles);
- while (it.hasNext()) {
- it.next();
+ for (auto it = roles.cbegin(), end = roles.cend(); it != end; ++it) {
QModelIndex sourceIndex = model->index(sourceRow, 0, sourceParent);
QString key = model->data(sourceIndex, it.key()).toString();
if (key.contains(rx))
diff --git a/examples/quickcontrols/controls/texteditor/src/documenthandler.cpp b/examples/quickcontrols/controls/texteditor/src/documenthandler.cpp
index 69da88f0..ac9f5bd4 100644
--- a/examples/quickcontrols/controls/texteditor/src/documenthandler.cpp
+++ b/examples/quickcontrols/controls/texteditor/src/documenthandler.cpp
@@ -345,7 +345,8 @@ QStringList DocumentHandler::defaultFontSizes() const
// uhm... this is quite ugly
QStringList sizes;
QFontDatabase db;
- foreach (int size, db.standardSizes())
+ const auto standardSizes = db.standardSizes();
+ for (int size : standardSizes)
sizes.append(QString::number(size));
return sizes;
}
diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp
index f9596d35..08f80713 100644
--- a/src/controls/Private/qquickstyleitem.cpp
+++ b/src/controls/Private/qquickstyleitem.cpp
@@ -1466,7 +1466,7 @@ void QQuickStyleItem1::paint(QPainter *painter)
case ItemRow :{
QPixmap pixmap;
// Only draw through style once
- const QString pmKey = QLatin1Literal("itemrow") % QString::number(m_styleoption->state,16) % activeControl();
+ const QString pmKey = QLatin1String("itemrow") % QString::number(m_styleoption->state,16) % activeControl();
if (!QPixmapCache::find(pmKey, &pixmap) || pixmap.width() < width() || height() != pixmap.height()) {
int newSize = width();
pixmap = QPixmap(newSize, height());
diff --git a/tests/auto/qquicktreemodeladaptor/tst_qquicktreemodeladaptor.cpp b/tests/auto/qquicktreemodeladaptor/tst_qquicktreemodeladaptor.cpp
index 0fec548d..c035c676 100644
--- a/tests/auto/qquicktreemodeladaptor/tst_qquicktreemodeladaptor.cpp
+++ b/tests/auto/qquicktreemodeladaptor/tst_qquicktreemodeladaptor.cpp
@@ -1181,8 +1181,8 @@ void tst_QQuickTreeModelAdaptor::reparentOnSameRow()
// at least DepthRole and ModeIndexRole changes should have happened for the affected row
bool depthChanged = false;
bool modelIndexChanged = false;
- QList<QList<QVariant> > &changes = dataChangedSpy;
- foreach (QList<QVariant> change, changes) {
+ const QList<QList<QVariant> > &changes = dataChangedSpy;
+ for (const QList<QVariant> &change : changes) {
if (change.at(0) == movedIndex) {
if (change.at(2).value<QVector<int> >().contains(QQuickTreeModelAdaptor1::DepthRole))
depthChanged = true;
@@ -1258,7 +1258,7 @@ void tst_QQuickTreeModelAdaptor::selectionForRowRange()
QCOMPARE(sel.count(), 2);
// We don't know in which order the selection ranges are
// being added, so we iterate and try to find what we expect.
- foreach (const QItemSelectionRange &range, sel) {
+ for (const QItemSelectionRange &range : sel) {
if (range.topLeft() == model.index(0, 0))
QCOMPARE(QModelIndex(range.bottomRight()), model.index(0, 0));
else if (range.topLeft() == model.index(0, 0, parent))
@@ -1275,7 +1275,7 @@ void tst_QQuickTreeModelAdaptor::selectionForRowRange()
QCOMPARE(sel.count(), 2);
// We don't know in which order the selection ranges are
// being added, so we iterate and try to find what we expect.
- foreach (const QItemSelectionRange &range, sel) {
+ for (const QItemSelectionRange &range : sel) {
if (range.topLeft() == model.index(0, 0))
QCOMPARE(QModelIndex(range.bottomRight()), model.index(4, 0));
else if (range.topLeft() == model.index(0, 0, parent))
@@ -1296,7 +1296,7 @@ void tst_QQuickTreeModelAdaptor::selectionForRowRange()
QCOMPARE(sel.count(), 3);
// We don't know in which order the selection ranges are
// being added, so we iterate and try to find what we expect.
- foreach (const QItemSelectionRange &range, sel) {
+ for (const QItemSelectionRange &range : sel) {
if (range.topLeft() == model.index(0, 0))
QCOMPARE(QModelIndex(range.bottomRight()), model.index(4, 0));
else if (range.topLeft() == model.index(0, 0, parent))
@@ -1319,7 +1319,7 @@ void tst_QQuickTreeModelAdaptor::selectionForRowRange()
QCOMPARE(sel.count(), 3);
// We don't know in which order the selection ranges are
// being added, so we iterate and try to find what we expect.
- foreach (const QItemSelectionRange &range, sel) {
+ for (const QItemSelectionRange &range : sel) {
if (range.topLeft() == model.index(0, 0))
QCOMPARE(QModelIndex(range.bottomRight()), model.index(0, 0));
else if (range.topLeft() == model.index(0, 0, parent))
@@ -1338,7 +1338,7 @@ void tst_QQuickTreeModelAdaptor::selectionForRowRange()
QCOMPARE(sel.count(), 4);
// We don't know in which order the selection ranges are
// being added, so we iterate and try to find what we expect.
- foreach (const QItemSelectionRange &range, sel) {
+ for (const QItemSelectionRange &range : sel) {
if (range.topLeft() == model.index(0, 0))
QCOMPARE(QModelIndex(range.bottomRight()), model.index(ModelRowCount - 1, 0));
else if (range.topLeft() == model.index(0, 0, parent))
@@ -1359,7 +1359,7 @@ void tst_QQuickTreeModelAdaptor::selectionForRowRange()
QCOMPARE(sel.count(), 4);
// We don't know in which order the selection ranges are
// being added, so we iterate and try to find what we expect.
- foreach (const QItemSelectionRange &range, sel) {
+ for (const QItemSelectionRange &range : sel) {
if (range.topLeft() == model.index(1, 0))
QCOMPARE(QModelIndex(range.bottomRight()), model.index(1, 0));
else if (range.topLeft() == model.index(1, 0, parent))
diff --git a/tests/auto/shared/testmodel.h b/tests/auto/shared/testmodel.h
index 6eaab74a..b1d9308e 100644
--- a/tests/auto/shared/testmodel.h
+++ b/tests/auto/shared/testmodel.h
@@ -289,8 +289,7 @@ public:
~Node()
{
- foreach (Node *n, children)
- delete n;
+ qDeleteAll(children);
}
void addRows(int row, int count)
diff --git a/tests/benchmarks/objectcount/tst_objectcount.cpp b/tests/benchmarks/objectcount/tst_objectcount.cpp
index c5797160..996b4b66 100644
--- a/tests/benchmarks/objectcount/tst_objectcount.cpp
+++ b/tests/benchmarks/objectcount/tst_objectcount.cpp
@@ -83,7 +83,7 @@ static void printItems(const QList<QQuickItem *> &items)
std::cout << " QQuickItems: " << items.count() << " (total of QObjects: " << qt_qobjects->count() << ")" << std::endl;
if (qt_verbose) {
- foreach (QObject *object, *qt_qobjects)
+ for (QObject *object : qAsConst(*qt_qobjects))
qInfo() << "\t" << object;
}
}
@@ -101,7 +101,7 @@ void tst_ObjectCount::controls()
QVERIFY2(object.data(), qPrintable(component.errorString()));
QList<QQuickItem *> items;
- foreach (QObject *object, *qt_qobjects()) {
+ for (QObject *object : qAsConst(*qt_qobjects)) {
QQuickItem *item = qobject_cast<QQuickItem *>(object);
if (item)
items += item;