diff options
Diffstat (limited to 'tests')
44 files changed, 123 insertions, 123 deletions
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index 5de7830113..1234b738ce 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -774,7 +774,7 @@ void tst_qmessagehandler::qMessagePattern() QVERIFY(!output.isEmpty()); QCOMPARE(!output.contains("QT_MESSAGE_PATTERN"), valid); - for (const QByteArray &e : qAsConst(expected)) { + for (const QByteArray &e : std::as_const(expected)) { if (!output.contains(e)) { // use QDebug so we get proper string escaping for the newlines QString buf; diff --git a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp index a3b31eda3f..f860a91cf5 100644 --- a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp +++ b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp @@ -611,7 +611,7 @@ template <typename UInt> static void boundedQuality_template() QVector<UInt> buffer(BufferCount, filler); generate(buffer.begin(), buffer.end(), [&] { return rng.bounded(Bound); }); - for (UInt value : qAsConst(buffer)) { + for (UInt value : std::as_const(buffer)) { QVERIFY(value < Bound); histogram[value]++; } diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp index 9b8225a3aa..ddeb9da649 100644 --- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -1847,7 +1847,7 @@ void ListenerObject::slotAboutToBeReset() void ListenerObject::slotReset() { - for (const auto &idx : qAsConst(m_persistentIndexes)) { + for (const auto &idx : std::as_const(m_persistentIndexes)) { QVERIFY(!idx.isValid()); } } diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index dacfa8e656..43651a8d7a 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -3214,15 +3214,15 @@ void tst_QSortFilterProxyModel::removeRowsRecursive() QList<QPersistentModelIndex> sourceIndexes; QList<QPersistentModelIndex> proxyIndexes; - for (const auto item : qAsConst(items)) { + for (const auto item : std::as_const(items)) { QModelIndex idx = item->index(); sourceIndexes << idx; proxyIndexes << proxy.mapFromSource(idx); } - for (const auto &pidx : qAsConst(sourceIndexes)) + for (const auto &pidx : std::as_const(sourceIndexes)) QVERIFY(pidx.isValid()); - for (const auto &pidx : qAsConst(proxyIndexes)) + for (const auto &pidx : std::as_const(proxyIndexes)) QVERIFY(pidx.isValid()); QList<QStandardItem*> itemRow = pItem1->takeRow(0); @@ -3230,9 +3230,9 @@ void tst_QSortFilterProxyModel::removeRowsRecursive() QCOMPARE(itemRow.size(), 1); QCOMPARE(itemRow.first(), pItem11); - for (const auto &pidx : qAsConst(sourceIndexes)) + for (const auto &pidx : std::as_const(sourceIndexes)) QVERIFY(!pidx.isValid()); - for (const auto &pidx : qAsConst(proxyIndexes)) + for (const auto &pidx : std::as_const(proxyIndexes)) QVERIFY(!pidx.isValid()); delete pItem11; diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 96aad8a26a..4b3df15e73 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -4303,7 +4303,7 @@ void testSequentialIteration() int numSeen = 0; auto varList = listVariant.value<QVariantList>(); auto varIter = varList.begin(); - for (const QVariant &v : qAsConst(listIter)) { + for (const QVariant &v : std::as_const(listIter)) { QVERIFY(ContainerAPI<Container>::compare(v, *varIter)); ++varIter; ++numSeen; diff --git a/tests/auto/corelib/serialization/json/tst_qtjson.cpp b/tests/auto/corelib/serialization/json/tst_qtjson.cpp index 7e01ca3f98..374d0cf10d 100644 --- a/tests/auto/corelib/serialization/json/tst_qtjson.cpp +++ b/tests/auto/corelib/serialization/json/tst_qtjson.cpp @@ -940,7 +940,7 @@ void tst_QtJson::testValueRef() QCOMPARE(object.value(QLatin1String("null")), QJsonValue()); object[QLatin1String("null")] = 100.; QCOMPARE(object.value(QLatin1String("null")).type(), QJsonValue::Double); - QJsonValue val = qAsConst(object)[QLatin1String("null")]; + QJsonValue val = std::as_const(object)[QLatin1String("null")]; QCOMPARE(val.toDouble(), 100.); QCOMPARE(object.size(), 2); diff --git a/tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp b/tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp index 52c4e6cfbe..898fb785e8 100644 --- a/tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp +++ b/tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp @@ -83,7 +83,7 @@ void encodeVariant(QCborStreamWriter &writer, const QVariant &v) } else { writer.startArray(list.size()); } - for (const QVariant &v2 : qAsConst(list)) + for (const QVariant &v2 : std::as_const(list)) encodeVariant(writer, v2); QVERIFY(writer.endArray()); return; @@ -96,7 +96,7 @@ void encodeVariant(QCborStreamWriter &writer, const QVariant &v) } else { writer.startMap(map.size()); } - for (auto pair : qAsConst(map)) { + for (auto pair : std::as_const(map)) { encodeVariant(writer, pair.first); encodeVariant(writer, pair.second); } diff --git a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp index 6c128016ba..80e0a21985 100644 --- a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp +++ b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp @@ -785,7 +785,7 @@ void tst_QCborValue::arrayInitializerList() // range for int i = 0; - for (const QCborValue v : qAsConst(a)) { + for (const QCborValue v : std::as_const(a)) { QVERIFY(!v.isInvalid()); QCOMPARE(v.isUndefined(), i == 5); // 6th element is Undefined ++i; @@ -885,7 +885,7 @@ void tst_QCborValue::mapSimpleInitializerList() // range for int i = 0; - for (auto pair : qAsConst(m)) { + for (auto pair : std::as_const(m)) { QVERIFY(!pair.first.isUndefined()); QVERIFY(!pair.second.isUndefined()); ++i; @@ -1294,16 +1294,16 @@ void tst_QCborValue::arrayValueRefLargeKey() a[LargeKey + 1] = 123; QCborValue v(a); - QCOMPARE(qAsConst(v)[LargeKey], QCborValue()); - QCOMPARE(qAsConst(v)[LargeKey + 1], 123); + QCOMPARE(std::as_const(v)[LargeKey], QCborValue()); + QCOMPARE(std::as_const(v)[LargeKey + 1], 123); QCOMPARE(v[LargeKey], QCborValue()); QCOMPARE(v[LargeKey + 1], 123); QCOMPARE(v.type(), QCborValue::Array); QCborArray outer = { QCborValue(a) }; QCborValueRef ref = outer[0]; - QCOMPARE(qAsConst(ref)[LargeKey], QCborValue()); - QCOMPARE(qAsConst(ref)[LargeKey + 1], 123); + QCOMPARE(std::as_const(ref)[LargeKey], QCborValue()); + QCOMPARE(std::as_const(ref)[LargeKey + 1], 123); QCOMPARE(ref[LargeKey], QCborValue()); QCOMPARE(ref[LargeKey + 1], 123); QCOMPARE(ref.type(), QCborValue::Array); @@ -1714,7 +1714,7 @@ void tst_QCborValue::arrayNested() QCborArray a1 = { 42, 47 }; QCborArray a2 = { QCborValue(a1) }; QCOMPARE(a2.size(), 1); - const QCborValue &first = qAsConst(a2).first(); + const QCborValue &first = std::as_const(a2).first(); QVERIFY(first.isArray()); QCOMPARE(first.toArray(wrongArray).size(), 2); QCOMPARE(first.toArray(wrongArray).first(), 42); @@ -1735,7 +1735,7 @@ void tst_QCborValue::arrayNested() QCborArray a1; a1 = { QCborValue(a1) }; // insert it into itself QCOMPARE(a1.size(), 1); - const QCborValue &first = qAsConst(a1).first(); + const QCborValue &first = std::as_const(a1).first(); QVERIFY(first.isArray()); QCOMPARE(first, QCborArray()); QCOMPARE(first.toArray(wrongArray), QCborArray()); @@ -1752,7 +1752,7 @@ void tst_QCborValue::arrayNested() QCborArray a1; a1.append(a1); // insert into itself QCOMPARE(a1.size(), 1); - const QCborValue &first = qAsConst(a1).first(); + const QCborValue &first = std::as_const(a1).first(); QVERIFY(first.isArray()); QCOMPARE(first, QCborArray()); QCOMPARE(first.toArray(), QCborArray()); @@ -2695,9 +2695,9 @@ template <typename ValueRef> static void cborValueRef_template() QCOMPARE(ref.toArray().isEmpty(), v.toArray().isEmpty()); QCOMPARE(ref.toMap().isEmpty(), v.toMap().isEmpty()); - QCOMPARE(ref[0], qAsConst(v)[0]); - QCOMPARE(ref[QLatin1String("other")], qAsConst(v)[QLatin1String("other")]); - QCOMPARE(ref[QString("other")], qAsConst(v)[QString("other")]); + QCOMPARE(ref[0], std::as_const(v)[0]); + QCOMPARE(ref[QLatin1String("other")], std::as_const(v)[QLatin1String("other")]); + QCOMPARE(ref[QString("other")], std::as_const(v)[QString("other")]); if (qIsNaN(v.toDouble())) QCOMPARE(qIsNaN(ref.toVariant().toDouble()), qIsNaN(v.toVariant().toDouble())); diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index f9ce102aea..e15682e81e 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -67,11 +67,11 @@ public: template <typename MemFun> void apply0(QString &s, MemFun mf) const - { for (QChar ch : qAsConst(this->pinned)) (s.*mf)(ch); } + { for (QChar ch : std::as_const(this->pinned)) (s.*mf)(ch); } template <typename MemFun, typename A1> void apply1(QString &s, MemFun mf, A1 a1) const - { for (QChar ch : qAsConst(this->pinned)) (s.*mf)(a1, ch); } + { for (QChar ch : std::as_const(this->pinned)) (s.*mf)(a1, ch); } }; template <> diff --git a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp index ccb12488a7..9eab2f6966 100644 --- a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp +++ b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp @@ -854,7 +854,7 @@ void tst_QStringView::overloadResolution() { std::u16string string; QStringViewOverloadResolution::test(string); - QStringViewOverloadResolution::test(qAsConst(string)); + QStringViewOverloadResolution::test(std::as_const(string)); QStringViewOverloadResolution::test(std::move(string)); } } diff --git a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp index 81120c6f67..6664bb4776 100644 --- a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp +++ b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp @@ -1076,13 +1076,13 @@ void tst_QFuture::multipleResults() QList<int> fasit = QList<int>() << 1 << 2 << 3 << 4; { QList<int> results; - for (int result : qAsConst(f)) + for (int result : std::as_const(f)) results.append(result); QCOMPARE(results, fasit); } { QList<int> results; - for (int result : qAsConst(copy)) + for (int result : std::as_const(copy)) results.append(result); QCOMPARE(results, fasit); } diff --git a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp index 60023e1bf2..722a174a32 100644 --- a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp +++ b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp @@ -746,14 +746,14 @@ void tst_ContainerApiSymmetry::front_back_impl() const auto c1 = make<Container>(1); QCOMPARE(clean(c1.front()), V(1)); QCOMPARE(clean(c1.back()), V(1)); - QCOMPARE(clean(qAsConst(c1).front()), V(1)); - QCOMPARE(clean(qAsConst(c1).back()), V(1)); + QCOMPARE(clean(std::as_const(c1).front()), V(1)); + QCOMPARE(clean(std::as_const(c1).back()), V(1)); auto c2 = make<Container>(2); QCOMPARE(clean(c2.front()), V(1)); QCOMPARE(clean(c2.back()), V(2)); - QCOMPARE(clean(qAsConst(c2).front()), V(1)); - QCOMPARE(clean(qAsConst(c2).back()), V(2)); + QCOMPARE(clean(std::as_const(c2).front()), V(1)); + QCOMPARE(clean(std::as_const(c2).back()), V(2)); } namespace { diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp index c21dfbfafb..81edb36916 100644 --- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp +++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp @@ -1108,7 +1108,7 @@ void tst_QVarLengthArray::operators() // +=: not provided, emulate //myvla += myvlatwo; - for (const QString &s : qAsConst(myvlatwo)) + for (const QString &s : std::as_const(myvlatwo)) myvla.push_back(s); QCOMPARE(myvla, combined); diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp index a6047d80bf..3fc6a0c1a2 100644 --- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp @@ -56,13 +56,13 @@ public: painter.drawText(rect(), Qt::AlignHCenter | Qt::AlignCenter, objectName()); static const QString pointFormat = QString::fromUtf8("\360\237\226\227 %1, %2"); painter.setPen(Qt::darkGreen); - for (const auto &pt : qAsConst(touchBeginPoints)) + for (const auto &pt : std::as_const(touchBeginPoints)) painter.drawText(pt.position(), pointFormat.arg(pt.position().toPoint().x()).arg(pt.position().toPoint().y())); painter.setPen(Qt::darkYellow); - for (const auto &pt : qAsConst(touchUpdatePoints)) + for (const auto &pt : std::as_const(touchUpdatePoints)) painter.drawText(pt.position(), pointFormat.arg(pt.position().toPoint().x()).arg(pt.position().toPoint().y())); painter.setPen(Qt::darkRed); - for (const auto &pt : qAsConst(touchEndPoints)) + for (const auto &pt : std::as_const(touchEndPoints)) painter.drawText(pt.position(), pointFormat.arg(pt.position().toPoint().x()).arg(pt.position().toPoint().y())); } @@ -79,7 +79,7 @@ public: auto touchEvent = static_cast<QTouchEvent *>(event); touchBeginPoints = touchEvent->points(); Q_ASSERT(touchBeginPoints.first().device() == touchEvent->pointingDevice()); - for (const QEventPoint &pt : qAsConst(touchBeginPoints)) + for (const QEventPoint &pt : std::as_const(touchBeginPoints)) lastNormalizedPositions << pt.normalizedPosition(); timestamp = touchEvent->timestamp(); deviceFromEvent = touchEvent->pointingDevice(); @@ -97,7 +97,7 @@ public: seenTouchUpdate = seenTouchBegin && !seenTouchEnd; auto touchEvent = static_cast<QTouchEvent *>(event); touchUpdatePoints = touchEvent->points(); - for (const QEventPoint &pt : qAsConst(touchUpdatePoints)) + for (const QEventPoint &pt : std::as_const(touchUpdatePoints)) lastNormalizedPositions << pt.normalizedPosition(); timestamp = touchEvent->timestamp(); deviceFromEvent = touchEvent->pointingDevice(); @@ -115,7 +115,7 @@ public: seenTouchEnd = seenTouchBegin && !seenTouchEnd; auto touchEvent = static_cast<QTouchEvent *>(event); touchEndPoints = touchEvent->points(); - for (const QEventPoint &pt : qAsConst(touchEndPoints)) + for (const QEventPoint &pt : std::as_const(touchEndPoints)) lastNormalizedPositions << pt.normalizedPosition(); timestamp = touchEvent->timestamp(); deviceFromEvent = touchEvent->pointingDevice(); diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 368fb07b23..e298603ca4 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -711,7 +711,7 @@ void tst_QWindow::stateChange() // explicitly use non-fullscreen show. show() can be fullscreen on some platforms window.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - for (Qt::WindowState state : qAsConst(stateSequence)) { + for (Qt::WindowState state : std::as_const(stateSequence)) { window.setWindowState(state); QCoreApplication::processEvents(); } diff --git a/tests/auto/gui/painting/qpageranges/tst_qpageranges.cpp b/tests/auto/gui/painting/qpageranges/tst_qpageranges.cpp index 00975906ed..4677399b3f 100644 --- a/tests/auto/gui/painting/qpageranges/tst_qpageranges.cpp +++ b/tests/auto/gui/painting/qpageranges/tst_qpageranges.cpp @@ -70,7 +70,7 @@ void tst_QPageRanges::addPage() QFETCH(PageRangeList, expected); QPageRanges result; - for (int pageNumber : qAsConst(pageNumbers)) { + for (int pageNumber : std::as_const(pageNumbers)) { if (QByteArrayView(QTest::currentDataTag()) == "invalid") QTest::ignoreMessage(QtWarningMsg, "QPageRanges::addPage: 'pageNumber' must be greater than 0"); result.addPage(pageNumber); @@ -112,7 +112,7 @@ void tst_QPageRanges::addRange() QFETCH(PageRangeList, expected); QPageRanges result; - for (const auto &range : qAsConst(ranges)) { + for (const auto &range : std::as_const(ranges)) { const QByteArrayView testdata(QTest::currentDataTag()); if (testdata.startsWith("invalid")) QTest::ignoreMessage(QtWarningMsg, "QPageRanges::addRange: 'from' and 'to' must be greater than 0"); diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 5f8d220272..4380433899 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -173,7 +173,7 @@ QNetworkInterface tst_QUdpSocket::interfaceForGroup(const QHostAddress &multicas static QNetworkInterface ipv6if = [&]() { // find any link local address in the allAddress list - for (const QHostAddress &addr: qAsConst(allAddresses)) { + for (const QHostAddress &addr: std::as_const(allAddresses)) { if (addr.isLoopback()) continue; @@ -269,7 +269,7 @@ void tst_QUdpSocket::initTestCase() // ff12:: is temporary, not prefix-based, link-local r[0] = qToBigEndian(Q_UINT64_C(0xff12) << 48); QHostAddress llbase(*reinterpret_cast<Q_IPV6ADDR *>(&r)); - for (const QHostAddress &a : qAsConst(allAddresses)) { + for (const QHostAddress &a : std::as_const(allAddresses)) { QString scope = a.scopeId(); if (scope.isEmpty()) continue; @@ -1334,7 +1334,7 @@ void tst_QUdpSocket::multicastJoinBeforeBind_data() QTest::newRow("valid ipv4 group address") << multicastGroup4; QTest::newRow("invalid ipv4 group address") << QHostAddress(QHostAddress::Broadcast); QTest::newRow("valid ipv6 group address") << multicastGroup6; - for (const QHostAddress &a : qAsConst(linklocalMulticastGroups)) + for (const QHostAddress &a : std::as_const(linklocalMulticastGroups)) QTest::addRow("valid ipv6 %s-link group address", a.scopeId().toLatin1().constData()) << a; QTest::newRow("invalid ipv6 group address") << QHostAddress(QHostAddress::AnyIPv6); } @@ -1354,7 +1354,7 @@ void tst_QUdpSocket::multicastLeaveAfterClose_data() QTest::addColumn<QHostAddress>("groupAddress"); QTest::newRow("ipv4") << multicastGroup4; QTest::newRow("ipv6") << multicastGroup6; - for (const QHostAddress &a : qAsConst(linklocalMulticastGroups)) + for (const QHostAddress &a : std::as_const(linklocalMulticastGroups)) QTest::addRow("ipv6-link-%s", a.scopeId().toLatin1().constData()) << a; } @@ -1448,13 +1448,13 @@ void tst_QUdpSocket::multicast_data() QTest::newRow("valid bind, group ipv4 address") << anyAddress << true << groupAddress << true; QTest::newRow("valid bind, invalid group ipv4 address") << anyAddress << true << anyAddress << false; QTest::newRow("valid bind, group ipv6 address") << any6Address << true << group6Address << true; - for (const QHostAddress &a : qAsConst(linklocalMulticastGroups)) + for (const QHostAddress &a : std::as_const(linklocalMulticastGroups)) QTest::addRow("valid bind, %s-link group ipv6 address", a.scopeId().toLatin1().constData()) << any6Address << true << a << true; QTest::newRow("valid bind, invalid group ipv6 address") << any6Address << true << any6Address << false; QTest::newRow("dual bind, group ipv4 address") << dualAddress << true << groupAddress << false; QTest::newRow("dual bind, group ipv6 address") << dualAddress << true << group6Address << true; - for (const QHostAddress &a : qAsConst(linklocalMulticastGroups)) + for (const QHostAddress &a : std::as_const(linklocalMulticastGroups)) QTest::addRow("dual bind, %s-link group ipv6 address", a.scopeId().toLatin1().constData()) << dualAddress << true << a << true; } diff --git a/tests/auto/network/ssl/qsslserver/tst_qsslserver.cpp b/tests/auto/network/ssl/qsslserver/tst_qsslserver.cpp index 5170f2f8b7..13a3201345 100644 --- a/tests/auto/network/ssl/qsslserver/tst_qsslserver.cpp +++ b/tests/auto/network/ssl/qsslserver/tst_qsslserver.cpp @@ -241,13 +241,13 @@ void tst_QSslServer::testSelfSignedCertificateRejectedByServer() // Check the sslErrorsSpy const auto sslErrorsSpyErrors = - qvariant_cast<QList<QSslError>>(qAsConst(server.sslErrorsSpy).first()[1]); + qvariant_cast<QList<QSslError>>(std::as_const(server.sslErrorsSpy).first()[1]); QCOMPARE(sslErrorsSpyErrors.size(), 1); QCOMPARE(sslErrorsSpyErrors.first().error(), certificateError); // Check the peerVerifyErrorSpy const auto peerVerifyErrorSpyError = - qvariant_cast<QSslError>(qAsConst(server.peerVerifyErrorSpy).first()[1]); + qvariant_cast<QSslError>(std::as_const(server.peerVerifyErrorSpy).first()[1]); QCOMPARE(peerVerifyErrorSpyError.error(), certificateError); // Check client socket @@ -302,7 +302,7 @@ void tst_QSslServer::testSelfSignedCertificateRejectedByClient() QCOMPARE(server.startedEncryptionHandshakeSpy.size(), 1); const auto errrOccuredSpyError = qvariant_cast<QAbstractSocket::SocketError>( - qAsConst(server.errorOccurredSpy).first()[1]); + std::as_const(server.errorOccurredSpy).first()[1]); QCOMPARE(errrOccuredSpyError, socketError); } else { // Client disconnected after connection accepted by server diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index cc81f41c67..b4d630ee54 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -970,7 +970,7 @@ void tst_QSslSocket::sslErrors() // check the same errors were emitted by sslErrors QVERIFY(!sslErrorsSpy.isEmpty()); SslErrorList emittedErrors; - const auto sslErrorsSpyErrors = qvariant_cast<QList<QSslError> >(qAsConst(sslErrorsSpy).first().first()); + const auto sslErrorsSpyErrors = qvariant_cast<QList<QSslError> >(std::as_const(sslErrorsSpy).first().first()); for (const QSslError &err : sslErrorsSpyErrors) emittedErrors << err.error(); std::sort(emittedErrors.begin(), emittedErrors.end()); diff --git a/tests/auto/network/ssl/shared/qopenssl_symbols.h b/tests/auto/network/ssl/shared/qopenssl_symbols.h index dff5bc8163..7f1f6c8285 100644 --- a/tests/auto/network/ssl/shared/qopenssl_symbols.h +++ b/tests/auto/network/ssl/shared/qopenssl_symbols.h @@ -481,7 +481,7 @@ QStringList findAllLibs(QLatin1String filter) QStringList entryList = dir.entryList(filters, QDir::Files); std::sort(entryList.begin(), entryList.end(), LibGreaterThan()); - for (const QString &entry : qAsConst(entryList)) + for (const QString &entry : std::as_const(entryList)) found << path + QLatin1Char('/') + entry; } diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index e4ce742e7c..6b058c88f4 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -1702,7 +1702,7 @@ void tst_QPrinter::reusePageMetrics() QPrinter defaultP; QPrinterInfo info(defaultP); QString otherPrinterName; - for (QPrinterInfo i : qAsConst(availablePrinters)) { + for (QPrinterInfo i : std::as_const(availablePrinters)) { if (i.printerName() != defaultP.printerName()) { otherPrinterName = i.printerName(); break; @@ -1712,9 +1712,9 @@ void tst_QPrinter::reusePageMetrics() QList<QPageSize> defaultPageSizes = info.supportedPageSizes(); QList<QPageSize> otherPageSizes = QPrinterInfo(otherP).supportedPageSizes(); QPageSize unavailableSizeToSet; - for (QPageSize s : qAsConst(defaultPageSizes)) { + for (QPageSize s : std::as_const(defaultPageSizes)) { bool found = false; - for (QPageSize os : qAsConst(otherPageSizes)) { + for (QPageSize os : std::as_const(otherPageSizes)) { if (os.isEquivalentTo(s)) { found = true; break; diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 159b968256..7bb69326bb 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -3609,7 +3609,7 @@ void tst_QSqlQuery::task_250026() void tst_QSqlQuery::crashQueryOnCloseDatabase() { - for (const auto &dbName : qAsConst(dbs.dbNames)) { + for (const auto &dbName : std::as_const(dbs.dbNames)) { const auto tidier = qScopeGuard([]() { QSqlDatabase::removeDatabase("crashTest"); }); // Note: destruction of clonedDb needs to happen before we call removeDatabase. QSqlDatabase clonedDb = QSqlDatabase::cloneDatabase( @@ -4825,7 +4825,7 @@ void tst_QSqlQuery::dateTime_data() #endif }; - for (const QString &dbName : qAsConst(dbs.dbNames)) { + for (const QString &dbName : std::as_const(dbs.dbNames)) { QSqlDatabase db = QSqlDatabase::database(dbName); if (!db.isValid()) continue; @@ -4868,13 +4868,13 @@ void tst_QSqlQuery::dateTime() QSqlQuery q(db); QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + createTableString)); - for (const QDateTime &dt : qAsConst(initialDateTimes)) { + for (const QDateTime &dt : std::as_const(initialDateTimes)) { QVERIFY_SQL(q, prepare(QLatin1String("INSERT INTO %1 values(:dt)").arg(tableName))); q.bindValue(":dt", dt); QVERIFY_SQL(q, exec()); } QVERIFY_SQL(q, exec("SELECT * FROM " + tableName)); - for (const QDateTime &dt : qAsConst(expectedDateTimes)) { + for (const QDateTime &dt : std::as_const(expectedDateTimes)) { QVERIFY(q.next()); QCOMPARE(q.value(0).toDateTime(), dt); } diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 709e384049..8b7028810f 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -3601,7 +3601,7 @@ void tst_QGraphicsItem::group() view.fitInView(scene.itemsBoundingRect()); - for (QGraphicsItem *item : qAsConst(newItems)) { + for (QGraphicsItem *item : std::as_const(newItems)) { group->addToGroup(item); QCOMPARE(item->group(), group); } diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 7ef8066ea1..0a1c47925d 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -532,7 +532,7 @@ void tst_QGraphicsScene::itemsBoundingRect() QGraphicsScene scene; - for (const auto &rect : qAsConst(rects)) { + for (const auto &rect : std::as_const(rects)) { QPainterPath path; path.addRect(rect); QGraphicsPathItem *item = scene.addPath(path); @@ -597,7 +597,7 @@ void tst_QGraphicsScene::items_QPointF() int n = 0; QList<QGraphicsItem *> addedItems; - for (const auto &rect : qAsConst(items)) { + for (const auto &rect : std::as_const(items)) { QPainterPath path; path.addRect(0, 0, rect.width(), rect.height()); @@ -1732,7 +1732,7 @@ void tst_QGraphicsScene::createItemGroup() // All items in children1 are children of parent1 QGraphicsItem *parent1 = scene.addRect(QRectF(-10, -10, 20, 20)); - for (QGraphicsItem *item : qAsConst(children1)) + for (QGraphicsItem *item : std::as_const(children1)) item->setParentItem(parent1); QGraphicsItemGroup *group = scene.createItemGroup(children1); @@ -1748,7 +1748,7 @@ void tst_QGraphicsScene::createItemGroup() // All items in children2 are children of parent2 QGraphicsItem *parent2 = scene.addRect(QRectF(-10, -10, 20, 20)); - for (QGraphicsItem *item : qAsConst(children2)) + for (QGraphicsItem *item : std::as_const(children2)) item->setParentItem(parent2); // Now make parent2 a child of parent1, so all children2 are also children @@ -1772,7 +1772,7 @@ void tst_QGraphicsScene::createItemGroup() QCOMPARE(children2.first()->parentItem(), parent1); // Fixup the parent-child chain - for (QGraphicsItem *item : qAsConst(children2)) + for (QGraphicsItem *item : std::as_const(children2)) item->setParentItem(parent2); // These share no common parent @@ -1782,7 +1782,7 @@ void tst_QGraphicsScene::createItemGroup() // Make children3 children of parent3 QGraphicsItem *parent3 = scene.addRect(QRectF(-10, -10, 20, 20)); - for (QGraphicsItem *item : qAsConst(children3)) + for (QGraphicsItem *item : std::as_const(children3)) item->setParentItem(parent3); // These should have parent3 as a parent diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index da68efadbb..01e50380f8 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -3032,7 +3032,7 @@ void tst_QAbstractItemView::mouseSelection() Qt::MouseButton buttonDown = Qt::NoButton; int targetRow = -1; QModelIndex pressedIndex; - for (const auto &event : qAsConst(selectionEvents)) { + for (const auto &event : std::as_const(selectionEvents)) { if (event.row != -1) targetRow = event.row; const QModelIndex targetIndex = model.index(targetRow, 0); diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 4e2903afd5..2a540feb66 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -2924,7 +2924,7 @@ public: root->kill(); QModelIndexList newList; - for (auto path : qAsConst(oldListPath)) { + for (auto path : std::as_const(oldListPath)) { QModelIndex idx; while (!path.isEmpty()) idx = index(path.pop(), 0, idx); diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index 4e48db662a..03c36260c1 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -2314,7 +2314,7 @@ void tst_QTreeWidget::insertExpandedItemsWithSorting() QCOMPARE(tree.model()->rowCount(), parentTexts.size()); // verify that the items are still expanded - for (const QTreeWidgetItem *item : qAsConst(items)) { + for (const QTreeWidgetItem *item : std::as_const(items)) { if (item->childCount() > 0) QVERIFY(item->isExpanded()); QModelIndex idx = tree.indexFromItem(item); @@ -2429,7 +2429,7 @@ void tst_QTreeWidget::changeDataWithSorting() item->setText(0, newValue); for (int i = 0; i < expectedItems.size(); ++i) { QCOMPARE(w.topLevelItem(i)->text(0), expectedItems.at(i)); - for (const QPersistentModelIndex &p : qAsConst(persistent)) { + for (const QPersistentModelIndex &p : std::as_const(persistent)) { if (p.row() == i) // the same toplevel row QCOMPARE(p.internalPointer(), static_cast<void *>(w.topLevelItem(i))); } @@ -2598,7 +2598,7 @@ void tst_QTreeWidget::changeDataWithStableSorting() item->emitDataChanged(); for (int i = 0; i < expectedItems.size(); ++i) { QCOMPARE(w.topLevelItem(i)->text(0), expectedItems.at(i)); - for (const QPersistentModelIndex &p : qAsConst(persistent)) { + for (const QPersistentModelIndex &p : std::as_const(persistent)) { if (p.row() == i) // the same toplevel row QCOMPARE(p.internalPointer(), static_cast<void *>(w.topLevelItem(i))); } diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 39f59f1408..6d563b446b 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -894,7 +894,7 @@ void tst_QApplication::closeAllWindows() // show all windows auto topLevels = QApplication::topLevelWidgets(); - for (QWidget *w : qAsConst(topLevels)) { + for (QWidget *w : std::as_const(topLevels)) { w->show(); QVERIFY(QTest::qWaitForWindowExposed(w)); } @@ -911,14 +911,14 @@ void tst_QApplication::closeAllWindows() PromptOnCloseWidget *promptOnCloseWidget = new PromptOnCloseWidget; // show all windows topLevels = QApplication::topLevelWidgets(); - for (QWidget *w : qAsConst(topLevels)) { + for (QWidget *w : std::as_const(topLevels)) { w->show(); QVERIFY(QTest::qWaitForWindowExposed(w)); } // close the last window to open the prompt (eventloop recurses) promptOnCloseWidget->close(); // all windows should not be visible, except the one that opened the prompt - for (QWidget *w : qAsConst(topLevels)) { + for (QWidget *w : std::as_const(topLevels)) { if (w == promptOnCloseWidget) QVERIFY(w->isVisible()); else @@ -2481,7 +2481,7 @@ void tst_QApplication::wheelEventPropagation() int vcount = 0; int hcount = 0; - for (const auto &event : qAsConst(events)) { + for (const auto &event : std::as_const(events)) { const QPoint pixelDelta = event.orientation == Qt::Vertical ? QPoint(0, -scrollStep) : QPoint(-scrollStep, 0); const QPoint angleDelta = event.orientation == Qt::Vertical ? QPoint(0, -120) : QPoint(-120, 0); QWindowSystemInterface::handleWheelEvent(outerArea.windowHandle(), center, global, diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 31205d7cd6..b27de649cf 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -3692,7 +3692,7 @@ void tst_QWidget::raise() QCOMPARE(parentPtr->children(), list1); QCOMPARE(allChildren.size(), list1.size()); - for (UpdateWidget *child : qAsConst(allChildren)) { + for (UpdateWidget *child : std::as_const(allChildren)) { int expectedPaintEvents = child == child4 ? 1 : 0; if (expectedPaintEvents == 0) { QCOMPARE(child->numPaintEvents, 0); @@ -3708,7 +3708,7 @@ void tst_QWidget::raise() child2->raise(); QTest::qWait(50); - for (UpdateWidget *child : qAsConst(allChildren)) { + for (UpdateWidget *child : std::as_const(allChildren)) { int expectedPaintEvents = child == child2 ? 1 : 0; int expectedZOrderChangeEvents = child == child2 ? 1 : 0; QTRY_COMPARE(child->numPaintEvents, expectedPaintEvents); @@ -3738,7 +3738,7 @@ void tst_QWidget::raise() onTop->reset(); // Reset all the children. - for (UpdateWidget *child : qAsConst(allChildren)) + for (UpdateWidget *child : std::as_const(allChildren)) child->reset(); for (int i = 0; i < 5; ++i) @@ -3751,7 +3751,7 @@ void tst_QWidget::raise() QObjectList list3{child1, child4, child2, child3}; QCOMPARE(parent->children(), list3); - for (UpdateWidget *child : qAsConst(allChildren)) { + for (UpdateWidget *child : std::as_const(allChildren)) { int expectedPaintEvents = 0; int expectedZOrderChangeEvents = child == child3 ? 1 : 0; QTRY_COMPARE(child->numPaintEvents, expectedPaintEvents); @@ -3791,7 +3791,7 @@ void tst_QWidget::lower() QCOMPARE(parent->children(), list1); QCOMPARE(allChildren.size(), list1.size()); - for (UpdateWidget *child : qAsConst(allChildren)) { + for (UpdateWidget *child : std::as_const(allChildren)) { int expectedPaintEvents = child == child4 ? 1 : 0; if (expectedPaintEvents == 0) { QCOMPARE(child->numPaintEvents, 0); @@ -3808,7 +3808,7 @@ void tst_QWidget::lower() QTest::qWait(100); - for (UpdateWidget *child : qAsConst(allChildren)) { + for (UpdateWidget *child : std::as_const(allChildren)) { int expectedPaintEvents = child == child3 ? 1 : 0; int expectedZOrderChangeEvents = child == child4 ? 1 : 0; QTRY_COMPARE(child->numZOrderChangeEvents, expectedZOrderChangeEvents); @@ -3854,7 +3854,7 @@ void tst_QWidget::stackUnder() QObjectList list1{child1, child2, child3, child4}; QCOMPARE(parent->children(), list1); - for (UpdateWidget *child : qAsConst(allChildren)) { + for (UpdateWidget *child : std::as_const(allChildren)) { int expectedPaintEvents = child == child4 ? 1 : 0; #if defined(Q_OS_WIN) || defined(Q_OS_MACOS) if (expectedPaintEvents == 1 && child->numPaintEvents == 2) @@ -3872,7 +3872,7 @@ void tst_QWidget::stackUnder() QObjectList list2{child1, child4, child2, child3}; QCOMPARE(parent->children(), list2); - for (UpdateWidget *child : qAsConst(allChildren)) { + for (UpdateWidget *child : std::as_const(allChildren)) { int expectedPaintEvents = child == child3 ? 1 : 0; int expectedZOrderChangeEvents = child == child4 ? 1 : 0; QTRY_COMPARE(child->numPaintEvents, expectedPaintEvents); @@ -3887,7 +3887,7 @@ void tst_QWidget::stackUnder() QObjectList list3{child4, child2, child1, child3}; QCOMPARE(parent->children(), list3); - for (UpdateWidget *child : qAsConst(allChildren)) { + for (UpdateWidget *child : std::as_const(allChildren)) { int expectedZOrderChangeEvents = child == child1 ? 1 : 0; if (child == child3) { #ifndef Q_OS_MACOS @@ -5653,7 +5653,7 @@ void tst_QWidget::setWindowGeometry_data() const Qt::WindowFlags windowFlags[] = {Qt::WindowFlags(), Qt::FramelessWindowHint}; const bool skipEmptyRects = (m_platform == QStringLiteral("windows")); - for (Rects l : qAsConst(rects)) { + for (Rects l : std::as_const(rects)) { if (skipEmptyRects) l.removeIf([] (const QRect &r) { return r.isEmpty(); }); const QRect &rect = l.constFirst(); @@ -5690,7 +5690,7 @@ void tst_QWidget::setWindowGeometry() QCOMPARE(widget.geometry(), rect); // setGeometry() without showing - for (const QRect &r : qAsConst(rects)) { + for (const QRect &r : std::as_const(rects)) { widget.setGeometry(r); QTest::qWait(100); QCOMPARE(widget.geometry(), r); @@ -5716,7 +5716,7 @@ void tst_QWidget::setWindowGeometry() QTRY_COMPARE(widget.geometry(), rect); // setGeometry() while shown - for (const QRect &r : qAsConst(rects)) { + for (const QRect &r : std::as_const(rects)) { widget.setGeometry(r); QTest::qWait(10); QTRY_COMPARE(widget.geometry(), r); @@ -5731,7 +5731,7 @@ void tst_QWidget::setWindowGeometry() QTRY_COMPARE(widget.geometry(), rect); // setGeometry() after hide() - for (const QRect &r : qAsConst(rects)) { + for (const QRect &r : std::as_const(rects)) { widget.setGeometry(r); QTest::qWait(10); QTRY_COMPARE(widget.geometry(), r); @@ -5767,7 +5767,7 @@ void tst_QWidget::setWindowGeometry() QTRY_COMPARE(widget.geometry(), rect); // setGeometry() while shown - for (const QRect &r : qAsConst(rects)) { + for (const QRect &r : std::as_const(rects)) { widget.setGeometry(r); QTest::qWait(10); QTRY_COMPARE(widget.geometry(), r); @@ -5782,7 +5782,7 @@ void tst_QWidget::setWindowGeometry() QTRY_COMPARE(widget.geometry(), rect); // setGeometry() after hide() - for (const QRect &r : qAsConst(rects)) { + for (const QRect &r : std::as_const(rects)) { widget.setGeometry(r); QTest::qWait(10); QTRY_COMPARE(widget.geometry(), r); @@ -5861,7 +5861,7 @@ void tst_QWidget::windowMoveResize() QTRY_COMPARE(widget.size(), rect.size()); // move() without showing - for (const QRect &r : qAsConst(rects)) { + for (const QRect &r : std::as_const(rects)) { widget.move(r.topLeft()); widget.resize(r.size()); QApplication::processEvents(); @@ -5891,7 +5891,7 @@ void tst_QWidget::windowMoveResize() QTRY_COMPARE(widget.size(), rect.size()); // move() while shown - for (const QRect &r : qAsConst(rects)) { + for (const QRect &r : std::as_const(rects)) { // XCB: First resize after show of zero-sized gets wrong win_gravity. const bool expectMoveFail = !windowFlags && ((widget.width() == 0 || widget.height() == 0) && r.width() != 0 && r.height() != 0) @@ -5920,7 +5920,7 @@ void tst_QWidget::windowMoveResize() QTRY_COMPARE(widget.size(), rect.size()); // move() after hide() - for (const QRect &r : qAsConst(rects)) { + for (const QRect &r : std::as_const(rects)) { widget.move(r.topLeft()); widget.resize(r.size()); QApplication::processEvents(); @@ -5971,7 +5971,7 @@ void tst_QWidget::windowMoveResize() QTRY_COMPARE(widget.size(), rect.size()); // move() while shown - for (const QRect &r : qAsConst(rects)) { + for (const QRect &r : std::as_const(rects)) { widget.move(r.topLeft()); widget.resize(r.size()); QApplication::processEvents(); @@ -5991,7 +5991,7 @@ void tst_QWidget::windowMoveResize() QTRY_COMPARE(widget.size(), rect.size()); // move() after hide() - for (const QRect &r : qAsConst(rects)) { + for (const QRect &r : std::as_const(rects)) { widget.move(r.topLeft()); widget.resize(r.size()); QApplication::processEvents(); @@ -6891,13 +6891,13 @@ void tst_QWidget::testWindowIconChangeEventPropagation() // Create spy lists. QList <EventSpyPtr> applicationEventSpies; QList <EventSpyPtr> widgetEventSpies; - for (QWidget *widget : qAsConst(widgets)) { + for (QWidget *widget : std::as_const(widgets)) { applicationEventSpies.append(EventSpyPtr::create(widget, QEvent::ApplicationWindowIconChange)); widgetEventSpies.append(EventSpyPtr::create(widget, QEvent::WindowIconChange)); } QList <WindowEventSpyPtr> appWindowEventSpies; QList <WindowEventSpyPtr> windowEventSpies; - for (QWindow *window : qAsConst(windows)) { + for (QWindow *window : std::as_const(windows)) { appWindowEventSpies.append(WindowEventSpyPtr::create(window, QEvent::ApplicationWindowIconChange)); windowEventSpies.append(WindowEventSpyPtr::create(window, QEvent::WindowIconChange)); } diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index fc182ae0f2..ce6ca20eb7 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -633,7 +633,7 @@ void tst_QStyle::testStyleOptionInit() QStringList keys = QStyleFactory::keys(); keys.prepend(QString()); // QCommonStyle marker - for (const QString &key : qAsConst(keys)) { + for (const QString &key : std::as_const(keys)) { QStyle* style = key.isEmpty() ? new QCommonStyle : QStyleFactory::create(key); TestStyleOptionInitProxy testStyle; testStyle.setBaseStyle(style); diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 7cb4f4d132..b4170452c8 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -1715,7 +1715,7 @@ void tst_QStyleSheetStyle::toolTip() topLevels = QApplication::topLevelWidgets(); QWidget *tooltip = nullptr; - for (QWidget *widget : qAsConst(topLevels)) { + for (QWidget *widget : std::as_const(topLevels)) { if (widget->inherits("QTipLabel")) { tooltip = widget; break; @@ -1731,7 +1731,7 @@ void tst_QStyleSheetStyle::toolTip() delete wid3; //should not crash; QTest::qWait(10); topLevels = QApplication::topLevelWidgets(); - for (QWidget *widget : qAsConst(topLevels)) + for (QWidget *widget : std::as_const(topLevels)) widget->update(); //should not crash either } diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index 561d082aff..9fcecd19bf 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -471,7 +471,7 @@ void tst_QMdiSubWindow::mainWindowSupport() workspace->activateNextSubWindow(); QCoreApplication::processEvents(); - for (QMdiSubWindow *window : qAsConst(windows)) { + for (QMdiSubWindow *window : std::as_const(windows)) { QCOMPARE(workspace->activeSubWindow(), window); QVERIFY(window->isMaximized()); QVERIFY(window->maximizedButtonsWidget()); diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp index cbc1a258de..ec3df1f03d 100644 --- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp @@ -920,7 +920,7 @@ void tst_QSplitter::task187373_addAbstractScrollAreas_data() "QTreeView" }; - for (const auto &className : qAsConst(classNames)) { + for (const auto &className : std::as_const(classNames)) { QTest::newRow(qPrintable(className + " 1")) << className << false << true; QTest::newRow(qPrintable(className + " 2")) << className << true << false; QTest::newRow(qPrintable(className + " 3")) << className << true << true; diff --git a/tests/benchmarks/corelib/io/qdir/tree/tst_bench_qdir_tree.cpp b/tests/benchmarks/corelib/io/qdir/tree/tst_bench_qdir_tree.cpp index 95ab82b90a..773f17a35a 100644 --- a/tests/benchmarks/corelib/io/qdir/tree/tst_bench_qdir_tree.cpp +++ b/tests/benchmarks/corelib/io/qdir/tree/tst_bench_qdir_tree.cpp @@ -69,7 +69,7 @@ private slots: stack.push(line); line = prefix; - for (const QByteArray &pathElement : qAsConst(stack)) + for (const QByteArray &pathElement : std::as_const(stack)) line += pathElement; if (line.endsWith('/')) diff --git a/tests/benchmarks/corelib/io/qfile/tst_bench_qfile.cpp b/tests/benchmarks/corelib/io/qfile/tst_bench_qfile.cpp index ea25a3fa98..b7e32be259 100644 --- a/tests/benchmarks/corelib/io/qfile/tst_bench_qfile.cpp +++ b/tests/benchmarks/corelib/io/qfile/tst_bench_qfile.cpp @@ -508,13 +508,13 @@ void tst_qfile::readSmallFiles() } QBENCHMARK { - for (QFile *const file : qAsConst(fileList)) { + for (QFile *const file : std::as_const(fileList)) { while (!file->atEnd()) file->read(buffer, blockSize); } } - for (QFile *const file : qAsConst(fileList)) { + for (QFile *const file : std::as_const(fileList)) { file->close(); delete file; } @@ -530,11 +530,11 @@ void tst_qfile::readSmallFiles() } QBENCHMARK { - for (QFSFileEngine *const fse : qAsConst(fileList)) + for (QFSFileEngine *const fse : std::as_const(fileList)) while (fse->read(buffer, blockSize)) {} } - for (QFSFileEngine *const fse : qAsConst(fileList)) { + for (QFSFileEngine *const fse : std::as_const(fileList)) { fse->close(); delete fse; } @@ -547,14 +547,14 @@ void tst_qfile::readSmallFiles() fileList.append(::fopen(QFile::encodeName(tempDir.filePath(file)).constData(), "rb")); QBENCHMARK { - for (FILE *const cfile : qAsConst(fileList)) { + for (FILE *const cfile : std::as_const(fileList)) { while (!feof(cfile)) [[maybe_unused]] auto f = ::fread(buffer, blockSize, 1, cfile); ::fseek(cfile, 0, SEEK_SET); } } - for (FILE *const cfile : qAsConst(fileList)) + for (FILE *const cfile : std::as_const(fileList)) ::fclose(cfile); } break; diff --git a/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_bench_qsortfilterproxymodel.cpp b/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_bench_qsortfilterproxymodel.cpp index f6a1a01085..76576fcf69 100644 --- a/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_bench_qsortfilterproxymodel.cpp +++ b/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_bench_qsortfilterproxymodel.cpp @@ -72,7 +72,7 @@ void tst_QSortFilterProxyModel::clearFilter() { QFETCH(const int, itemCount); resizeNumberList(m_numberList, itemCount); - QStringListModel model(qAsConst(m_numberList)); + QStringListModel model(std::as_const(m_numberList)); QCOMPARE(model.rowCount(), itemCount); QSortFilterProxyModel proxy; diff --git a/tests/benchmarks/gui/painting/lancebench/tst_lancebench.cpp b/tests/benchmarks/gui/painting/lancebench/tst_lancebench.cpp index 7d047dcd8f..a16299250b 100644 --- a/tests/benchmarks/gui/painting/lancebench/tst_lancebench.cpp +++ b/tests/benchmarks/gui/painting/lancebench/tst_lancebench.cpp @@ -81,7 +81,7 @@ void tst_LanceBench::initTestCase() } std::sort(qpsFiles.begin(), qpsFiles.end()); - for (const QString& fileName : qAsConst(qpsFiles)) { + for (const QString& fileName : std::as_const(qpsFiles)) { QFile file(scriptsDir + fileName); file.open(QFile::ReadOnly); QByteArray cont = file.readAll(); @@ -237,7 +237,7 @@ void tst_LanceBench::testCoreOpenGL() void tst_LanceBench::setupTestSuite(const QStringList& blacklist) { QTest::addColumn<QString>("qpsFile"); - for (const QString &fileName : qAsConst(qpsFiles)) { + for (const QString &fileName : std::as_const(qpsFiles)) { if (blacklist.contains(fileName)) continue; QTest::newRow(fileName.toLatin1()) << fileName; diff --git a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp index 40ef3cdd53..cccf9c703c 100644 --- a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp @@ -670,7 +670,7 @@ void tst_QPainter::drawPixmapImage_data_helper(bool pixmaps) for (; *targetFormats != QImage::Format_Invalid; ++targetFormats) { const QImage::Format *sourceFormats = pixmaps ? pixmapFormats : sourceImageFormats; for (; *sourceFormats != QImage::Format_Invalid; ++sourceFormats) { - for (const QSize &s : qAsConst(sizes)) { + for (const QSize &s : std::as_const(sizes)) { for (int type=0; type<=3; ++type) { QString name = QString::fromLatin1("%1 on %2, (%3x%4), %5") .arg(formatNames[*sourceFormats]) diff --git a/tests/benchmarks/sql/kernel/qsqlrecord/tst_bench_qsqlrecord.cpp b/tests/benchmarks/sql/kernel/qsqlrecord/tst_bench_qsqlrecord.cpp index d1dc3aea19..ae1b92a32c 100644 --- a/tests/benchmarks/sql/kernel/qsqlrecord/tst_bench_qsqlrecord.cpp +++ b/tests/benchmarks/sql/kernel/qsqlrecord/tst_bench_qsqlrecord.cpp @@ -39,7 +39,7 @@ QTEST_MAIN(tst_QSqlRecord) void tst_QSqlRecord::initTestCase() { dbs.open(); - for (const auto &dbName : qAsConst(dbs.dbNames)) { + for (const auto &dbName : std::as_const(dbs.dbNames)) { QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); dropTestTables(db); // In case of leftovers @@ -50,7 +50,7 @@ void tst_QSqlRecord::initTestCase() void tst_QSqlRecord::cleanupTestCase() { - for (const auto &dbName : qAsConst(dbs.dbNames)) { + for (const auto &dbName : std::as_const(dbs.dbNames)) { QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); dropTestTables(db); diff --git a/tests/manual/diaglib/qwidgetdump.cpp b/tests/manual/diaglib/qwidgetdump.cpp index 5cdef5818a..bfa93008be 100644 --- a/tests/manual/diaglib/qwidgetdump.cpp +++ b/tests/manual/diaglib/qwidgetdump.cpp @@ -123,7 +123,7 @@ void dumpAllWidgets(FormatWindowOptions options, const QWidget *root) topLevels.append(const_cast<QWidget *>(root)); else topLevels = QApplication::topLevelWidgets(); - for (QWidget *tw : qAsConst(topLevels)) + for (QWidget *tw : std::as_const(topLevels)) dumpWidgetRecursion(str, tw, options); for (const QString &line : d.split(QLatin1Char('\n'))) qDebug().noquote() << line; diff --git a/tests/manual/foreignwindows/main.cpp b/tests/manual/foreignwindows/main.cpp index b457bf02b0..1264656390 100644 --- a/tests/manual/foreignwindows/main.cpp +++ b/tests/manual/foreignwindows/main.cpp @@ -277,7 +277,7 @@ int main(int argc, char *argv[]) QPoint pos = availableGeometry.topLeft() + QPoint(availableGeometry.width(), availableGeometry.height()) / 3; WidgetPtrList mainWindows; - for (QWindow *window : qAsConst(windows)) { + for (QWindow *window : std::as_const(windows)) { WidgetPtr mainWindow(new EmbeddingWindow(window)); mainWindow->move(pos); mainWindow->resize(availableGeometry.size() / 4); diff --git a/tests/manual/highdpi/kitchensink/main.cpp b/tests/manual/highdpi/kitchensink/main.cpp index 861707e6b9..fcc9af7928 100644 --- a/tests/manual/highdpi/kitchensink/main.cpp +++ b/tests/manual/highdpi/kitchensink/main.cpp @@ -1433,7 +1433,7 @@ int main(int argc, char **argv) demoList << new DemoContainer<GraphicsViewCaching>("graphicsview", "Test QGraphicsView caching"); demoList << new DemoContainer<MetricsTest>("metrics", "Show screen metrics"); - for (DemoContainerBase *demo : qAsConst(demoList)) + for (DemoContainerBase *demo : std::as_const(demoList)) parser.addOption(demo->option()); parser.process(app); diff --git a/tests/manual/qtabletevent/regular_widgets/main.cpp b/tests/manual/qtabletevent/regular_widgets/main.cpp index 68f204088f..f6dab99976 100644 --- a/tests/manual/qtabletevent/regular_widgets/main.cpp +++ b/tests/manual/qtabletevent/regular_widgets/main.cpp @@ -152,7 +152,7 @@ void EventReportWidget::paintEvent(QPaintEvent *) p.setPen(Qt::white); QPainterPath ellipse; ellipse.addEllipse(0, 0, halfLineSpacing * 5, halfLineSpacing); - for (const TabletPoint &t : qAsConst(m_points)) { + for (const TabletPoint &t : std::as_const(m_points)) { if (geom.contains(t.pos)) { QPainterPath pp; pp.addEllipse(t.pos, halfLineSpacing, halfLineSpacing); diff --git a/tests/manual/touch/main.cpp b/tests/manual/touch/main.cpp index 5bac1e8c91..80155ddb57 100644 --- a/tests/manual/touch/main.cpp +++ b/tests/manual/touch/main.cpp @@ -382,7 +382,7 @@ void TouchTestWidget::paintEvent(QPaintEvent *) const QRectF geom = QRectF(QPointF(0, 0), QSizeF(size())); painter.fillRect(geom, Qt::white); painter.drawRect(QRectF(geom.topLeft(), geom.bottomRight() - QPointF(1, 1))); - for (const Point &point : qAsConst(m_points)) { + for (const Point &point : std::as_const(m_points)) { if (geom.contains(point.pos)) { if (point.type == MouseRelease) drawEllipse(point.pos, point.horizontalDiameter, point.verticalDiameter, point.color(), painter); @@ -390,7 +390,7 @@ void TouchTestWidget::paintEvent(QPaintEvent *) fillEllipse(point.pos, point.horizontalDiameter, point.verticalDiameter, point.color(), painter); } } - for (const GesturePtr &gp : qAsConst(m_gestures)) + for (const GesturePtr &gp : std::as_const(m_gestures)) gp->draw(geom, painter); } |