From 1ef274fb947f86731d062df2128718cc8a0cf643 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 2 Apr 2019 11:51:14 +0200 Subject: Replace qMove with std::move Change-Id: I67df3ae6b5db0a158f86e75b99f422bd13853bc9 Reviewed-by: Thiago Macieira Reviewed-by: Joerg Bornemann --- .../itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp | 2 +- .../corelib/thread/qatomicinteger/tst_qatomicinteger.cpp | 8 ++++---- tests/auto/corelib/tools/collections/tst_collections.cpp | 2 +- tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp | 16 ++++++++-------- .../corelib/tools/qbytearraylist/tst_qbytearraylist.cpp | 10 +++++----- .../tools/qcontiguouscache/tst_qcontiguouscache.cpp | 2 +- .../corelib/tools/qsharedpointer/tst_qsharedpointer.cpp | 4 ++-- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 16 ++++++++-------- .../corelib/tools/qversionnumber/tst_qversionnumber.cpp | 12 ++++++------ tests/auto/gui/image/qimage/tst_qimage.cpp | 2 +- tests/auto/gui/kernel/qpalette/tst_qpalette.cpp | 4 ++-- tests/auto/gui/painting/qpen/tst_qpen.cpp | 8 ++++---- .../kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp | 2 +- .../dialogs/qprogressdialog/tst_qprogressdialog.cpp | 4 ++-- 14 files changed, 46 insertions(+), 46 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp index 0b8686560c..3919472b96 100644 --- a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp +++ b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp @@ -333,7 +333,7 @@ template C sorted(C c) { std::sort(c.begin(), c.end()); - return qMove(c); + return std::move(c); } void tst_QStringListModel::setData_emits_both_roles() diff --git a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp index 32e5b8ee56..3a98732f9d 100644 --- a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp +++ b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp @@ -291,10 +291,10 @@ void tst_QAtomicIntegerXX::copy() QCOMPARE(copy2.load(), atomic.load()); // move - QAtomicInteger copy3(qMove(copy)); + QAtomicInteger copy3(std::move(copy)); QCOMPARE(copy3.load(), atomic.load()); - QAtomicInteger copy4 = qMove(copy2); + QAtomicInteger copy4 = std::move(copy2); QCOMPARE(copy4.load(), atomic.load()); } @@ -317,11 +317,11 @@ void tst_QAtomicIntegerXX::assign() // move QAtomicInteger copy3; - copy3 = qMove(copy); + copy3 = std::move(copy); QCOMPARE(copy3.load(), atomic.load()); QAtomicInteger copy4; - copy4 = qMove(copy2); + copy4 = std::move(copy2); QCOMPARE(copy4.load(), atomic.load()); } diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp index b40b1f0624..104de4d783 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.cpp @@ -2425,7 +2425,7 @@ void testContainer() c1 = newInstance(); QVERIFY(c1.size() == 4); QVERIFY(c1 == newInstance()); - Container c2 = qMove(c1); + Container c2 = std::move(c1); QVERIFY(c2.size() == 4); QVERIFY(c2 == newInstance()); } diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index d9e03439b8..2dbf86c2f5 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -2245,28 +2245,28 @@ void tst_QByteArray::toUpperLower() QCOMPARE(input.toLower(), lower); QByteArray copy = input; - QCOMPARE(qMove(copy).toUpper(), upper); + QCOMPARE(std::move(copy).toUpper(), upper); copy = input; copy.detach(); - QCOMPARE(qMove(copy).toUpper(), upper); + QCOMPARE(std::move(copy).toUpper(), upper); copy = input; - QCOMPARE(qMove(copy).toLower(), lower); + QCOMPARE(std::move(copy).toLower(), lower); copy = input; copy.detach(); - QCOMPARE(qMove(copy).toLower(), lower); + QCOMPARE(std::move(copy).toLower(), lower); copy = lower; - QCOMPARE(qMove(copy).toLower(), lower); + QCOMPARE(std::move(copy).toLower(), lower); copy = lower; copy.detach(); - QCOMPARE(qMove(copy).toLower(), lower); + QCOMPARE(std::move(copy).toLower(), lower); copy = upper; - QCOMPARE(qMove(copy).toUpper(), upper); + QCOMPARE(std::move(copy).toUpper(), upper); copy = upper; copy.detach(); - QCOMPARE(qMove(copy).toUpper(), upper); + QCOMPARE(std::move(copy).toUpper(), upper); } void tst_QByteArray::isUpper() diff --git a/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp b/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp index 2d2c536453..a28bbc12c8 100644 --- a/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp +++ b/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp @@ -194,22 +194,22 @@ void tst_QByteArrayList::operator_plus() const { QByteArrayList bal1 = lhs; const QByteArrayList bal2 = rhs; - QCOMPARE(qMove(bal1) + bal2, expectedResult); + QCOMPARE(std::move(bal1) + bal2, expectedResult); } { QList lba1 = lhs; const QByteArrayList bal2 = rhs; - QCOMPARE(qMove(lba1) + bal2, expectedResult); + QCOMPARE(std::move(lba1) + bal2, expectedResult); } { QByteArrayList bal1 = lhs; const QList lba2 = rhs; - QCOMPARE(qMove(bal1) + lba2, expectedResult); + QCOMPARE(std::move(bal1) + lba2, expectedResult); } { QList lba1 = lhs; const QList lba2 = rhs; - QCOMPARE(qMove(lba1) + lba2, QList(expectedResult)); // check we don't mess with old code + QCOMPARE(std::move(lba1) + lba2, QList(expectedResult)); // check we don't mess with old code } // operator += for const lvalues @@ -232,7 +232,7 @@ void tst_QByteArrayList::operator_plus() const QByteArrayList t1 = lhs; QByteArrayList t2 = rhs; - QCOMPARE(qMove(t1) + t2, expectedResult); + QCOMPARE(std::move(t1) + t2, expectedResult); } void tst_QByteArrayList::operator_plus_data() const diff --git a/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp index 31a5f93822..9b45e17a28 100644 --- a/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp +++ b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp @@ -68,7 +68,7 @@ void tst_QContiguousCache::assignment() // copy: cc1 = cc2; // move: - cc1 = qMove(cc2); + cc1 = std::move(cc2); } void tst_QContiguousCache::empty() diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index ade9c5e754..ebec83403a 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -573,10 +573,10 @@ void tst_QSharedPointer::useOfForwardDeclared() // move assignment: QSharedPointer sp4; - sp4 = qMove(sp); + sp4 = std::move(sp); // and move constuction: - QSharedPointer sp5 = qMove(sp2); + QSharedPointer sp5 = std::move(sp2); // swapping: sp4.swap(sp3); diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index e25c9e8395..d891ef7e12 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -2202,12 +2202,12 @@ void tst_QString::toUpper() // call rvalue-ref while shared (the original mustn't change) QString copy = s; - QCOMPARE(qMove(copy).toUpper(), QString("GROSSSTRASSE")); + QCOMPARE(std::move(copy).toUpper(), QString("GROSSSTRASSE")); QCOMPARE(s, QString::fromUtf8("Gro\xc3\x9fstra\xc3\x9f""e")); // call rvalue-ref version on detached case copy.clear(); - QCOMPARE(qMove(s).toUpper(), QString("GROSSSTRASSE")); + QCOMPARE(std::move(s).toUpper(), QString("GROSSSTRASSE")); } QString lower, upper; @@ -2417,11 +2417,11 @@ void tst_QString::trimmed() QCOMPARE(a.trimmed(), QLatin1String("a")); a="Text"; - QCOMPARE(qMove(a).trimmed(), QLatin1String("Text")); + QCOMPARE(std::move(a).trimmed(), QLatin1String("Text")); a=" "; - QCOMPARE(qMove(a).trimmed(), QLatin1String("")); + QCOMPARE(std::move(a).trimmed(), QLatin1String("")); a=" a "; - QCOMPARE(qMove(a).trimmed(), QLatin1String("a")); + QCOMPARE(std::move(a).trimmed(), QLatin1String("a")); } void tst_QString::simplified_data() @@ -2476,13 +2476,13 @@ void tst_QString::simplified() // without detaching: QString copy1 = full; - QCOMPARE(qMove(full).simplified(), simple); + QCOMPARE(std::move(full).simplified(), simple); QCOMPARE(full, orig_full); // force a detach if (!full.isEmpty()) full[0] = full[0]; - QCOMPARE(qMove(full).simplified(), simple); + QCOMPARE(std::move(full).simplified(), simple); } void tst_QString::insert_data(bool emptyIsNoop) @@ -4524,7 +4524,7 @@ void tst_QString::toLatin1Roundtrip() // try the rvalue version of toLatin1() QString s = unicodesrc; - QCOMPARE(qMove(s).toLatin1(), latin1); + QCOMPARE(std::move(s).toLatin1(), latin1); // and verify that the moved-from object can still be used s = "foo"; diff --git a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp index 05579dce6e..aaf40a9c2e 100644 --- a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp +++ b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp @@ -436,7 +436,7 @@ void tst_QVersionNumber::normalized() QFETCH(QVersionNumber, expected); QCOMPARE(version.normalized(), expected); - QCOMPARE(qMove(version).normalized(), expected); + QCOMPARE(std::move(version).normalized(), expected); } void tst_QVersionNumber::isNormalized_data() @@ -590,21 +590,21 @@ void tst_QVersionNumber::moveSemantics() // QVersionNumber(QVersionNumber &&) { QVersionNumber v1(1, 2, 3); - QVersionNumber v2 = qMove(v1); + QVersionNumber v2 = std::move(v1); QCOMPARE(v2, QVersionNumber(1, 2, 3)); } // QVersionNumber &operator=(QVersionNumber &&) { QVersionNumber v1(1, 2, 3); QVersionNumber v2; - v2 = qMove(v1); + v2 = std::move(v1); QCOMPARE(v2, QVersionNumber(1, 2, 3)); } // QVersionNumber(QVector &&) { QVector segments = QVector() << 1 << 2 << 3; QVersionNumber v1(segments); - QVersionNumber v2(qMove(segments)); + QVersionNumber v2(std::move(segments)); QVERIFY(!v1.isNull()); QVERIFY(!v2.isNull()); QCOMPARE(v1, v2); @@ -620,7 +620,7 @@ void tst_QVersionNumber::moveSemantics() QVERIFY(!v.isNull()); QVERIFY(!nv.isNull()); QVERIFY(nv.isNormalized()); - nv = qMove(v).normalized(); + nv = std::move(v).normalized(); QVERIFY(!nv.isNull()); QVERIFY(nv.isNormalized()); } @@ -632,7 +632,7 @@ void tst_QVersionNumber::moveSemantics() segments = v.segments(); QVERIFY(!v.isNull()); QVERIFY(!segments.empty()); - segments = qMove(v).segments(); + segments = std::move(v).segments(); QVERIFY(!segments.empty()); } #endif diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 4d41b5e873..50eb61b219 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -3403,7 +3403,7 @@ void tst_QImage::ditherGradient_data() QTest::newRow("rgb32 -> rgb666 (dithering)") << rgb32 << QImage::Format_RGB666 << int(Qt::PreferDither | Qt::OrderedDither) << 129; // Test we get the same results for opaque input in the ARGBPM implementation. - rgb32 = qMove(rgb32).convertToFormat(QImage::Format_ARGB32_Premultiplied); + rgb32 = std::move(rgb32).convertToFormat(QImage::Format_ARGB32_Premultiplied); QTest::newRow("argb32pm -> argb4444pm (no dither)") << rgb32 << QImage::Format_ARGB4444_Premultiplied << 0 << 16; QTest::newRow("argb32pm -> rgb444 (dithering)") << rgb32 << QImage::Format_RGB444 << int(Qt::PreferDither | Qt::OrderedDither) << 33; QTest::newRow("argb32pm -> argb4444pm (dithering)") << rgb32 << QImage::Format_ARGB4444_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 33; diff --git a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp index 7f29b1c24e..234793a7cf 100644 --- a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp +++ b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp @@ -148,14 +148,14 @@ void tst_QPalette::moveSemantics() QCOMPARE(src, control); QVERIFY(!dst.isCopyOf(src)); QVERIFY(!dst.isCopyOf(control)); - dst = qMove(src); // move assignment + dst = std::move(src); // move assignment QVERIFY(!dst.isCopyOf(src)); // isCopyOf() works on moved-from palettes, too QVERIFY(dst.isCopyOf(control)); QCOMPARE(dst, control); src = control; // check moved-from 'src' can still be assigned to (doesn't crash) QVERIFY(src.isCopyOf(dst)); QVERIFY(src.isCopyOf(control)); - QPalette dst2(qMove(src)); // move construction + QPalette dst2(std::move(src)); // move construction QVERIFY(!src.isCopyOf(dst)); QVERIFY(!src.isCopyOf(dst2)); QVERIFY(!src.isCopyOf(control)); diff --git a/tests/auto/gui/painting/qpen/tst_qpen.cpp b/tests/auto/gui/painting/qpen/tst_qpen.cpp index ef65d653ce..295ae27d17 100644 --- a/tests/auto/gui/painting/qpen/tst_qpen.cpp +++ b/tests/auto/gui/painting/qpen/tst_qpen.cpp @@ -95,7 +95,7 @@ void tst_QPen::move() QPen p1(Qt::black); // check that moving does the right thing: - QPen p2 = qMove(p1); // could be move or copy construction, so don't check p1's state + QPen p2 = std::move(p1); // could be move or copy construction, so don't check p1's state QCOMPARE(p2.color(), QColor(Qt::black)); // this, executed ehre, would crash: @@ -110,7 +110,7 @@ void tst_QPen::move() QCOMPARE(p1.color(), QColor(Qt::yellow)); // check that moved-from QPens p2, p3 can still be safely destroyed: - QPen p5 = qMove(p2); + QPen p5 = std::move(p2); // intentionally no more statements beyond this point } @@ -120,7 +120,7 @@ void tst_QPen::move_assign() QPen p1(Qt::black), p2(Qt::white); // check that moving does the right thing: - p2 = qMove(p1); // could be move or copy assignment, so don't check p1's state + p2 = std::move(p1); // could be move or copy assignment, so don't check p1's state QCOMPARE(p2.color(), QColor(Qt::black)); // check that move-assigned-from QPen p1 can still be used, albeit @@ -137,7 +137,7 @@ void tst_QPen::move_assign() // check that moved-from QPens p2, p3 can still be safely destroyed: QPen p5; - p5 = qMove(p2); + p5 = std::move(p2); // intentionally no more statements beyond this point } diff --git a/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp b/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp index 5eedd1043b..cd6019090f 100644 --- a/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp +++ b/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp @@ -131,7 +131,7 @@ void tst_QNetworkDatagram::makeReply() QNetworkDatagram copy = dgram; copy.setData(copy.data()); { - QNetworkDatagram reply = qMove(copy).makeReply("World"); + QNetworkDatagram reply = std::move(copy).makeReply("World"); QCOMPARE(reply.data(), QByteArray("World")); QCOMPARE(reply.senderAddress(), QHostAddress(localAddress)); QCOMPARE(reply.senderPort(), localAddress.isEmpty() ? -1 : dgram.destinationPort()); diff --git a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp index 2ada4fedb6..6f527e7b6b 100644 --- a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp +++ b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp @@ -252,7 +252,7 @@ class QTestTranslator : public QTranslator { const QString m_str; public: - explicit QTestTranslator(QString str) : m_str(qMove(str)) {} + explicit QTestTranslator(QString str) : m_str(std::move(str)) {} QString translate(const char *, const char *sourceText, const char *, int) const override { return m_str + sourceText + m_str; } @@ -265,7 +265,7 @@ class QTranslatorGuard { Translator t; public: template - explicit QTranslatorGuard(Arg a) : t(qMove(a)) + explicit QTranslatorGuard(Arg a) : t(std::move(a)) { qApp->installTranslator(&t); } ~QTranslatorGuard() { qApp->removeTranslator(&t); } -- cgit v1.2.3