Replace qMove with std::move

Change-Id: I67df3ae6b5db0a158f86e75b99f422bd13853bc9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2019-04-02 11:51:14 +02:00
parent 980755bbcf
commit 1ef274fb94
40 changed files with 89 additions and 89 deletions

View File

@ -407,7 +407,7 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
stopStream(); stopStream();
if (!startStream()) { if (!startStream()) {
// ok, something went wrong, let's try to restore the previous state // ok, something went wrong, let's try to restore the previous state
watchingState = qMove(oldState); watchingState = std::move(oldState);
// and because we don't know which path caused the issue (if any), fail on all of them // and because we don't know which path caused the issue (if any), fail on all of them
p = paths; p = paths;
@ -474,7 +474,7 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
if (needsRestart) { if (needsRestart) {
if (!restartStream()) { if (!restartStream()) {
watchingState = qMove(oldState); watchingState = std::move(oldState);
startStream(); startStream();
} }
} }

View File

@ -534,7 +534,7 @@ QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QSharedPointer
*/ */
QSharedPointer<QNonContiguousByteDevice> QNonContiguousByteDeviceFactory::createShared(QSharedPointer<QRingBuffer> ringBuffer) QSharedPointer<QNonContiguousByteDevice> QNonContiguousByteDeviceFactory::createShared(QSharedPointer<QRingBuffer> ringBuffer)
{ {
return QSharedPointer<QNonContiguousByteDeviceRingBufferImpl>::create(qMove(ringBuffer)); return QSharedPointer<QNonContiguousByteDeviceRingBufferImpl>::create(std::move(ringBuffer));
} }
/*! /*!

View File

@ -227,7 +227,7 @@ public:
friend bool operator!=(const RestorableId &lhs, const RestorableId &rhs) noexcept friend bool operator!=(const RestorableId &lhs, const RestorableId &rhs) noexcept
{ return !operator==(lhs, rhs); } { return !operator==(lhs, rhs); }
public: public:
explicit RestorableId(QObject *o, QByteArray p) noexcept : guard(o), obj(o), prop(qMove(p)) {} explicit RestorableId(QObject *o, QByteArray p) noexcept : guard(o), obj(o), prop(std::move(p)) {}
QObject *object() const noexcept { return guard; } QObject *object() const noexcept { return guard; }
QByteArray propertyName() const noexcept { return prop; } QByteArray propertyName() const noexcept { return prop; }
}; };

View File

@ -3282,10 +3282,10 @@ static QByteArray toCase_template(T &input, const uchar * table)
} }
if (firstBad == e) if (firstBad == e)
return qMove(input); return std::move(input);
// transform the rest // transform the rest
QByteArray s = qMove(input); // will copy if T is const QByteArray QByteArray s = std::move(input); // will copy if T is const QByteArray
char *b = s.begin(); // will detach if necessary char *b = s.begin(); // will detach if necessary
char *p = b + (firstBad - orig_begin); char *p = b + (firstBad - orig_begin);
e = b + s.size(); e = b + s.size();

View File

@ -59,7 +59,7 @@ void QRingChunk::detach()
const int chunkSize = size(); const int chunkSize = size();
QByteArray x(chunkSize, Qt::Uninitialized); QByteArray x(chunkSize, Qt::Uninitialized);
::memcpy(x.data(), chunk.constData() + headOffset, chunkSize); ::memcpy(x.data(), chunk.constData() + headOffset, chunkSize);
chunk = qMove(x); chunk = std::move(x);
headOffset = 0; headOffset = 0;
tailOffset = chunkSize; tailOffset = chunkSize;
} }

View File

@ -4458,7 +4458,7 @@ int QString::indexOf(const QRegularExpression &re, int from, QRegularExpressionM
if (match.hasMatch()) { if (match.hasMatch()) {
const int ret = match.capturedStart(); const int ret = match.capturedStart();
if (rmatch) if (rmatch)
*rmatch = qMove(match); *rmatch = std::move(match);
return ret; return ret;
} }
@ -4514,7 +4514,7 @@ int QString::lastIndexOf(const QRegularExpression &re, int from, QRegularExpress
if (start < endpos) { if (start < endpos) {
lastIndex = start; lastIndex = start;
if (rmatch) if (rmatch)
*rmatch = qMove(match); *rmatch = std::move(match);
} else { } else {
break; break;
} }
@ -4557,7 +4557,7 @@ bool QString::contains(const QRegularExpression &re, QRegularExpressionMatch *ma
QRegularExpressionMatch m = re.match(*this); QRegularExpressionMatch m = re.match(*this);
bool hasMatch = m.hasMatch(); bool hasMatch = m.hasMatch();
if (hasMatch && match) if (hasMatch && match)
*match = qMove(m); *match = std::move(m);
return hasMatch; return hasMatch;
} }
@ -4717,7 +4717,7 @@ QString QString::section(const QString &sep, int start, int end, SectionFlags fl
class qt_section_chunk { class qt_section_chunk {
public: public:
qt_section_chunk() {} qt_section_chunk() {}
qt_section_chunk(int l, QStringRef s) : length(l), string(qMove(s)) {} qt_section_chunk(int l, QStringRef s) : length(l), string(std::move(s)) {}
int length; int length;
QStringRef string; QStringRef string;
}; };
@ -6609,7 +6609,7 @@ Q_NEVER_INLINE
static QString detachAndConvertCase(T &str, QStringIterator it) static QString detachAndConvertCase(T &str, QStringIterator it)
{ {
Q_ASSERT(!str.isEmpty()); Q_ASSERT(!str.isEmpty());
QString s = qMove(str); // will copy if T is const QString QString s = std::move(str); // will copy if T is const QString
QChar *pp = s.begin() + it.index(); // will detach if necessary QChar *pp = s.begin() + it.index(); // will detach if necessary
do { do {
@ -6667,7 +6667,7 @@ static QString convertCase(T &str)
return detachAndConvertCase<Traits>(str, it); return detachAndConvertCase<Traits>(str, it);
} }
} }
return qMove(str); return std::move(str);
} }
} // namespace QUnicodeTables } // namespace QUnicodeTables

View File

@ -77,7 +77,7 @@ template <typename StringType> struct QStringAlgorithms
if (begin != data) if (begin != data)
memmove(data, begin, (end - begin) * sizeof(Char)); memmove(data, begin, (end - begin) * sizeof(Char));
str.resize(end - begin); str.resize(end - begin);
return qMove(str); return std::move(str);
} }
static inline StringType trimmed_helper_inplace(const NakedStringType &, const Char *, const Char *) static inline StringType trimmed_helper_inplace(const NakedStringType &, const Char *, const Char *)
@ -118,7 +118,7 @@ template <typename StringType> struct QStringAlgorithms
const Char *end = str.cend(); const Char *end = str.cend();
NakedStringType result = isConst || !str.isDetached() ? NakedStringType result = isConst || !str.isDetached() ?
StringType(str.size(), Qt::Uninitialized) : StringType(str.size(), Qt::Uninitialized) :
qMove(str); std::move(str);
Char *dst = const_cast<Char *>(result.cbegin()); Char *dst = const_cast<Char *>(result.cbegin());
Char *ptr = dst; Char *ptr = dst;

View File

@ -773,9 +773,9 @@ void QVector<T>::append(const T &t)
realloc(isTooSmall ? d->size + 1 : d->alloc, opt); realloc(isTooSmall ? d->size + 1 : d->alloc, opt);
if (QTypeInfo<T>::isComplex) if (QTypeInfo<T>::isComplex)
new (d->end()) T(qMove(copy)); new (d->end()) T(std::move(copy));
else else
*d->end() = qMove(copy); *d->end() = std::move(copy);
} else { } else {
if (QTypeInfo<T>::isComplex) if (QTypeInfo<T>::isComplex)

View File

@ -482,7 +482,7 @@ QVersionNumber QVersionNumber::fromString(QLatin1String string, int *suffixIndex
if (suffixIndex) if (suffixIndex)
*suffixIndex = int(lastGoodEnd - string.begin()); *suffixIndex = int(lastGoodEnd - string.begin());
return QVersionNumber(qMove(seg)); return QVersionNumber(std::move(seg));
} }
void QVersionNumber::SegmentStorage::setVector(int len, int maj, int min, int mic) void QVersionNumber::SegmentStorage::setVector(int len, int maj, int min, int mic)

View File

@ -185,7 +185,7 @@ bool QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, void *retu
if (reply.signature() != QLatin1String("v")) { if (reply.signature() != QLatin1String("v")) {
QString errmsg = QLatin1String("Invalid signature `%1' in return from call to " QString errmsg = QLatin1String("Invalid signature `%1' in return from call to "
DBUS_INTERFACE_PROPERTIES); DBUS_INTERFACE_PROPERTIES);
lastError = QDBusError(QDBusError::InvalidSignature, qMove(errmsg).arg(reply.signature())); lastError = QDBusError(QDBusError::InvalidSignature, std::move(errmsg).arg(reply.signature()));
return false; return false;
} }

View File

@ -1196,7 +1196,7 @@ void QDBusConnectionPrivate::doDispatch()
PendingMessageList::Iterator end = pendingMessages.end(); PendingMessageList::Iterator end = pendingMessages.end();
for ( ; it != end; ++it) { for ( ; it != end; ++it) {
qDBusDebug() << this << "dequeueing message" << *it; qDBusDebug() << this << "dequeueing message" << *it;
handleMessage(qMove(*it)); handleMessage(std::move(*it));
} }
pendingMessages.clear(); pendingMessages.clear();
} }

View File

@ -1396,7 +1396,7 @@ void QImage::setColorTable(const QVector<QRgb> colors)
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) #if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
d->colortable = colors; d->colortable = colors;
#else #else
d->colortable = qMove(const_cast<QVector<QRgb>&>(colors)); d->colortable = std::move(const_cast<QVector<QRgb>&>(colors));
#endif #endif
d->has_alpha_clut = false; d->has_alpha_clut = false;
for (int i = 0; i < d->colortable.size(); ++i) { for (int i = 0; i < d->colortable.size(); ++i) {
@ -5587,7 +5587,7 @@ Q_GUI_EXPORT void qt_imageTransform(QImage &src, QImageIOHandler::Transformation
if (orient == QImageIOHandler::TransformationRotate270) { if (orient == QImageIOHandler::TransformationRotate270) {
src = rotated270(src); src = rotated270(src);
} else { } else {
src = qMove(src).mirrored(orient & QImageIOHandler::TransformationMirror, src = std::move(src).mirrored(orient & QImageIOHandler::TransformationMirror,
orient & QImageIOHandler::TransformationFlip); orient & QImageIOHandler::TransformationFlip);
if (orient & QImageIOHandler::TransformationRotate90) if (orient & QImageIOHandler::TransformationRotate90)
src = rotated90(src); src = rotated90(src);

View File

@ -291,11 +291,11 @@ public:
QImage mirrored(bool horizontally = false, bool vertically = true) const & QImage mirrored(bool horizontally = false, bool vertically = true) const &
{ return mirrored_helper(horizontally, vertically); } { return mirrored_helper(horizontally, vertically); }
QImage &&mirrored(bool horizontally = false, bool vertically = true) && QImage &&mirrored(bool horizontally = false, bool vertically = true) &&
{ mirrored_inplace(horizontally, vertically); return qMove(*this); } { mirrored_inplace(horizontally, vertically); return std::move(*this); }
QImage rgbSwapped() const & QImage rgbSwapped() const &
{ return rgbSwapped_helper(); } { return rgbSwapped_helper(); }
QImage &&rgbSwapped() && QImage &&rgbSwapped() &&
{ rgbSwapped_inplace(); return qMove(*this); } { rgbSwapped_inplace(); return std::move(*this); }
#else #else
QImage mirrored(bool horizontally = false, bool vertically = true) const; QImage mirrored(bool horizontally = false, bool vertically = true) const;
QImage rgbSwapped() const; QImage rgbSwapped() const;

View File

@ -549,7 +549,7 @@ public:
}; };
class Attribute { class Attribute {
public: public:
Attribute(AttributeType typ, int s, int l, QVariant val) : type(typ), start(s), length(l), value(qMove(val)) {} Attribute(AttributeType typ, int s, int l, QVariant val) : type(typ), start(s), length(l), value(std::move(val)) {}
Attribute(AttributeType typ, int s, int l) : type(typ), start(s), length(l), value() {} Attribute(AttributeType typ, int s, int l) : type(typ), start(s), length(l), value() {}
AttributeType type; AttributeType type;

View File

@ -66,7 +66,7 @@ class QOpenGL2GradientCache : public QOpenGLSharedResource
struct CacheInfo struct CacheInfo
{ {
inline CacheInfo(QGradientStops s, qreal op, QGradient::InterpolationMode mode) : inline CacheInfo(QGradientStops s, qreal op, QGradient::InterpolationMode mode) :
stops(qMove(s)), opacity(op), interpolationMode(mode) {} stops(std::move(s)), opacity(op), interpolationMode(mode) {}
GLuint texId; GLuint texId;
QGradientStops stops; QGradientStops stops;

View File

@ -1140,11 +1140,11 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
if (s.version() >= QDataStream::Qt_5_5) { if (s.version() >= QDataStream::Qt_5_5) {
QImage img; QImage img;
s >> img; s >> img;
b.setTextureImage(qMove(img)); b.setTextureImage(std::move(img));
} else { } else {
QPixmap pm; QPixmap pm;
s >> pm; s >> pm;
b.setTexture(qMove(pm)); b.setTexture(std::move(pm));
} }
} else if (style == Qt::LinearGradientPattern } else if (style == Qt::LinearGradientPattern
|| style == Qt::RadialGradientPattern || style == Qt::RadialGradientPattern

View File

@ -4244,7 +4244,7 @@ public:
struct CacheInfo : QSpanData::Pinnable struct CacheInfo : QSpanData::Pinnable
{ {
inline CacheInfo(QGradientStops s, int op, QGradient::InterpolationMode mode) : inline CacheInfo(QGradientStops s, int op, QGradient::InterpolationMode mode) :
stops(qMove(s)), opacity(op), interpolationMode(mode) {} stops(std::move(s)), opacity(op), interpolationMode(mode) {}
QRgba64 buffer64[GRADIENT_STOPTABLE_SIZE]; QRgba64 buffer64[GRADIENT_STOPTABLE_SIZE];
QRgb buffer32[GRADIENT_STOPTABLE_SIZE]; QRgb buffer32[GRADIENT_STOPTABLE_SIZE];
QGradientStops stops; QGradientStops stops;

View File

@ -73,7 +73,7 @@ int QTextureGlyphCache::calculateSubPixelPositionCount(glyph_t glyph) const
if (path.isEmpty()) if (path.isEmpty())
break; break;
images[numImages++] = qMove(img); images[numImages++] = std::move(img);
} else { } else {
bool found = false; bool found = false;
for (int j = 0; j < numImages; ++j) { for (int j = 0; j < numImages; ++j) {
@ -83,7 +83,7 @@ int QTextureGlyphCache::calculateSubPixelPositionCount(glyph_t glyph) const
} }
} }
if (!found) if (!found)
images[numImages++] = qMove(img); images[numImages++] = std::move(img);
} }
} }

View File

@ -1318,7 +1318,7 @@ QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16
: QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt, connectionType)), parent) : QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt, connectionType)), parent)
{ {
Q_D(QHttpNetworkConnection); Q_D(QHttpNetworkConnection);
d->networkSession = qMove(networkSession); d->networkSession = std::move(networkSession);
d->init(); d->init();
} }
@ -1330,7 +1330,7 @@ QHttpNetworkConnection::QHttpNetworkConnection(quint16 connectionCount, const QS
connectionType)), parent) connectionType)), parent)
{ {
Q_D(QHttpNetworkConnection); Q_D(QHttpNetworkConnection);
d->networkSession = qMove(networkSession); d->networkSession = std::move(networkSession);
d->init(); d->init();
} }
#else #else
@ -1477,7 +1477,7 @@ QSharedPointer<QSslContext> QHttpNetworkConnection::sslContext()
void QHttpNetworkConnection::setSslContext(QSharedPointer<QSslContext> context) void QHttpNetworkConnection::setSslContext(QSharedPointer<QSslContext> context)
{ {
Q_D(QHttpNetworkConnection); Q_D(QHttpNetworkConnection);
d->sslContext = qMove(context); d->sslContext = std::move(context);
} }
void QHttpNetworkConnection::ignoreSslErrors(int channel) void QHttpNetworkConnection::ignoreSslErrors(int channel)

View File

@ -189,7 +189,7 @@ public:
QHttpNetworkConnection::ConnectionType connectionType, QHttpNetworkConnection::ConnectionType connectionType,
QSharedPointer<QNetworkSession> networkSession) QSharedPointer<QNetworkSession> networkSession)
: QHttpNetworkConnection(hostName, port, encrypt, connectionType, /*parent=*/0, : QHttpNetworkConnection(hostName, port, encrypt, connectionType, /*parent=*/0,
qMove(networkSession)) std::move(networkSession))
#endif #endif
{ {
setExpires(true); setExpires(true);

View File

@ -1512,7 +1512,7 @@ static void getFamiliesAndSignatures(const QByteArray &fontData,
if (names.name.isEmpty()) if (names.name.isEmpty())
continue; continue;
families->append(qMove(names)); families->append(std::move(names));
if (values || signatures) if (values || signatures)
getFontTable(data, font, MAKE_TAG('O', 'S', '/', '2'), &table, &length); getFontTable(data, font, MAKE_TAG('O', 'S', '/', '2'), &table, &length);

View File

@ -251,7 +251,7 @@ QString QTeamCityLogger::tcEscapedString(const QString &str) const
} }
} }
return qMove(formattedString).simplified(); return std::move(formattedString).simplified();
} }
QString QTeamCityLogger::escapedTestFuncName() const QString QTeamCityLogger::escapedTestFuncName() const

View File

@ -2148,7 +2148,7 @@ QSharedPointer<QTemporaryDir> QTest::qExtractTestData(const QString &dirName)
} }
} }
result = qMove(tempDir); result = std::move(tempDir);
return result; return result;
} }

View File

@ -322,8 +322,8 @@ bool QErrorMessagePrivate::nextPending()
#else #else
errors->setPlainText(message); errors->setPlainText(message);
#endif #endif
currentMessage = qMove(message); currentMessage = std::move(message);
currentType = qMove(type); currentType = std::move(type);
return true; return true;
} }
} }

View File

@ -851,7 +851,7 @@ QHash<QStyle::SubControl, QRect> QStyleSheetStyle::titleBarLayout(const QWidget
info.rule = subRule; info.rule = subRule;
info.offset = offsets[where]; info.offset = offsets[where];
info.where = where; info.where = where;
infos.append(qMove(info)); infos.append(std::move(info));
offsets[where] += info.width; offsets[where] += info.width;
} }

View File

@ -333,7 +333,7 @@ template <class C>
C sorted(C c) C sorted(C c)
{ {
std::sort(c.begin(), c.end()); std::sort(c.begin(), c.end());
return qMove(c); return std::move(c);
} }
void tst_QStringListModel::setData_emits_both_roles() void tst_QStringListModel::setData_emits_both_roles()

View File

@ -291,10 +291,10 @@ void tst_QAtomicIntegerXX::copy()
QCOMPARE(copy2.load(), atomic.load()); QCOMPARE(copy2.load(), atomic.load());
// move // move
QAtomicInteger<T> copy3(qMove(copy)); QAtomicInteger<T> copy3(std::move(copy));
QCOMPARE(copy3.load(), atomic.load()); QCOMPARE(copy3.load(), atomic.load());
QAtomicInteger<T> copy4 = qMove(copy2); QAtomicInteger<T> copy4 = std::move(copy2);
QCOMPARE(copy4.load(), atomic.load()); QCOMPARE(copy4.load(), atomic.load());
} }
@ -317,11 +317,11 @@ void tst_QAtomicIntegerXX::assign()
// move // move
QAtomicInteger<T> copy3; QAtomicInteger<T> copy3;
copy3 = qMove(copy); copy3 = std::move(copy);
QCOMPARE(copy3.load(), atomic.load()); QCOMPARE(copy3.load(), atomic.load());
QAtomicInteger<T> copy4; QAtomicInteger<T> copy4;
copy4 = qMove(copy2); copy4 = std::move(copy2);
QCOMPARE(copy4.load(), atomic.load()); QCOMPARE(copy4.load(), atomic.load());
} }

View File

@ -2425,7 +2425,7 @@ void testContainer()
c1 = newInstance<Container>(); c1 = newInstance<Container>();
QVERIFY(c1.size() == 4); QVERIFY(c1.size() == 4);
QVERIFY(c1 == newInstance<Container>()); QVERIFY(c1 == newInstance<Container>());
Container c2 = qMove(c1); Container c2 = std::move(c1);
QVERIFY(c2.size() == 4); QVERIFY(c2.size() == 4);
QVERIFY(c2 == newInstance<Container>()); QVERIFY(c2 == newInstance<Container>());
} }

View File

@ -2245,28 +2245,28 @@ void tst_QByteArray::toUpperLower()
QCOMPARE(input.toLower(), lower); QCOMPARE(input.toLower(), lower);
QByteArray copy = input; QByteArray copy = input;
QCOMPARE(qMove(copy).toUpper(), upper); QCOMPARE(std::move(copy).toUpper(), upper);
copy = input; copy = input;
copy.detach(); copy.detach();
QCOMPARE(qMove(copy).toUpper(), upper); QCOMPARE(std::move(copy).toUpper(), upper);
copy = input; copy = input;
QCOMPARE(qMove(copy).toLower(), lower); QCOMPARE(std::move(copy).toLower(), lower);
copy = input; copy = input;
copy.detach(); copy.detach();
QCOMPARE(qMove(copy).toLower(), lower); QCOMPARE(std::move(copy).toLower(), lower);
copy = lower; copy = lower;
QCOMPARE(qMove(copy).toLower(), lower); QCOMPARE(std::move(copy).toLower(), lower);
copy = lower; copy = lower;
copy.detach(); copy.detach();
QCOMPARE(qMove(copy).toLower(), lower); QCOMPARE(std::move(copy).toLower(), lower);
copy = upper; copy = upper;
QCOMPARE(qMove(copy).toUpper(), upper); QCOMPARE(std::move(copy).toUpper(), upper);
copy = upper; copy = upper;
copy.detach(); copy.detach();
QCOMPARE(qMove(copy).toUpper(), upper); QCOMPARE(std::move(copy).toUpper(), upper);
} }
void tst_QByteArray::isUpper() void tst_QByteArray::isUpper()

View File

@ -194,22 +194,22 @@ void tst_QByteArrayList::operator_plus() const
{ {
QByteArrayList bal1 = lhs; QByteArrayList bal1 = lhs;
const QByteArrayList bal2 = rhs; const QByteArrayList bal2 = rhs;
QCOMPARE(qMove(bal1) + bal2, expectedResult); QCOMPARE(std::move(bal1) + bal2, expectedResult);
} }
{ {
QList<QByteArray> lba1 = lhs; QList<QByteArray> lba1 = lhs;
const QByteArrayList bal2 = rhs; const QByteArrayList bal2 = rhs;
QCOMPARE(qMove(lba1) + bal2, expectedResult); QCOMPARE(std::move(lba1) + bal2, expectedResult);
} }
{ {
QByteArrayList bal1 = lhs; QByteArrayList bal1 = lhs;
const QList<QByteArray> lba2 = rhs; const QList<QByteArray> lba2 = rhs;
QCOMPARE(qMove(bal1) + lba2, expectedResult); QCOMPARE(std::move(bal1) + lba2, expectedResult);
} }
{ {
QList<QByteArray> lba1 = lhs; QList<QByteArray> lba1 = lhs;
const QList<QByteArray> lba2 = rhs; const QList<QByteArray> lba2 = rhs;
QCOMPARE(qMove(lba1) + lba2, QList<QByteArray>(expectedResult)); // check we don't mess with old code QCOMPARE(std::move(lba1) + lba2, QList<QByteArray>(expectedResult)); // check we don't mess with old code
} }
// operator += for const lvalues // operator += for const lvalues
@ -232,7 +232,7 @@ void tst_QByteArrayList::operator_plus() const
QByteArrayList t1 = lhs; QByteArrayList t1 = lhs;
QByteArrayList t2 = rhs; QByteArrayList t2 = rhs;
QCOMPARE(qMove(t1) + t2, expectedResult); QCOMPARE(std::move(t1) + t2, expectedResult);
} }
void tst_QByteArrayList::operator_plus_data() const void tst_QByteArrayList::operator_plus_data() const

View File

@ -68,7 +68,7 @@ void tst_QContiguousCache::assignment()
// copy: // copy:
cc1 = cc2; cc1 = cc2;
// move: // move:
cc1 = qMove(cc2); cc1 = std::move(cc2);
} }
void tst_QContiguousCache::empty() void tst_QContiguousCache::empty()

View File

@ -573,10 +573,10 @@ void tst_QSharedPointer::useOfForwardDeclared()
// move assignment: // move assignment:
QSharedPointer<ForwardDeclared> sp4; QSharedPointer<ForwardDeclared> sp4;
sp4 = qMove(sp); sp4 = std::move(sp);
// and move constuction: // and move constuction:
QSharedPointer<ForwardDeclared> sp5 = qMove(sp2); QSharedPointer<ForwardDeclared> sp5 = std::move(sp2);
// swapping: // swapping:
sp4.swap(sp3); sp4.swap(sp3);

View File

@ -2202,12 +2202,12 @@ void tst_QString::toUpper()
// call rvalue-ref while shared (the original mustn't change) // call rvalue-ref while shared (the original mustn't change)
QString copy = s; 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")); QCOMPARE(s, QString::fromUtf8("Gro\xc3\x9fstra\xc3\x9f""e"));
// call rvalue-ref version on detached case // call rvalue-ref version on detached case
copy.clear(); copy.clear();
QCOMPARE(qMove(s).toUpper(), QString("GROSSSTRASSE")); QCOMPARE(std::move(s).toUpper(), QString("GROSSSTRASSE"));
} }
QString lower, upper; QString lower, upper;
@ -2417,11 +2417,11 @@ void tst_QString::trimmed()
QCOMPARE(a.trimmed(), QLatin1String("a")); QCOMPARE(a.trimmed(), QLatin1String("a"));
a="Text"; a="Text";
QCOMPARE(qMove(a).trimmed(), QLatin1String("Text")); QCOMPARE(std::move(a).trimmed(), QLatin1String("Text"));
a=" "; a=" ";
QCOMPARE(qMove(a).trimmed(), QLatin1String("")); QCOMPARE(std::move(a).trimmed(), QLatin1String(""));
a=" a "; a=" a ";
QCOMPARE(qMove(a).trimmed(), QLatin1String("a")); QCOMPARE(std::move(a).trimmed(), QLatin1String("a"));
} }
void tst_QString::simplified_data() void tst_QString::simplified_data()
@ -2476,13 +2476,13 @@ void tst_QString::simplified()
// without detaching: // without detaching:
QString copy1 = full; QString copy1 = full;
QCOMPARE(qMove(full).simplified(), simple); QCOMPARE(std::move(full).simplified(), simple);
QCOMPARE(full, orig_full); QCOMPARE(full, orig_full);
// force a detach // force a detach
if (!full.isEmpty()) if (!full.isEmpty())
full[0] = full[0]; full[0] = full[0];
QCOMPARE(qMove(full).simplified(), simple); QCOMPARE(std::move(full).simplified(), simple);
} }
void tst_QString::insert_data(bool emptyIsNoop) void tst_QString::insert_data(bool emptyIsNoop)
@ -4524,7 +4524,7 @@ void tst_QString::toLatin1Roundtrip()
// try the rvalue version of toLatin1() // try the rvalue version of toLatin1()
QString s = unicodesrc; 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 // and verify that the moved-from object can still be used
s = "foo"; s = "foo";

View File

@ -436,7 +436,7 @@ void tst_QVersionNumber::normalized()
QFETCH(QVersionNumber, expected); QFETCH(QVersionNumber, expected);
QCOMPARE(version.normalized(), expected); QCOMPARE(version.normalized(), expected);
QCOMPARE(qMove(version).normalized(), expected); QCOMPARE(std::move(version).normalized(), expected);
} }
void tst_QVersionNumber::isNormalized_data() void tst_QVersionNumber::isNormalized_data()
@ -590,21 +590,21 @@ void tst_QVersionNumber::moveSemantics()
// QVersionNumber(QVersionNumber &&) // QVersionNumber(QVersionNumber &&)
{ {
QVersionNumber v1(1, 2, 3); QVersionNumber v1(1, 2, 3);
QVersionNumber v2 = qMove(v1); QVersionNumber v2 = std::move(v1);
QCOMPARE(v2, QVersionNumber(1, 2, 3)); QCOMPARE(v2, QVersionNumber(1, 2, 3));
} }
// QVersionNumber &operator=(QVersionNumber &&) // QVersionNumber &operator=(QVersionNumber &&)
{ {
QVersionNumber v1(1, 2, 3); QVersionNumber v1(1, 2, 3);
QVersionNumber v2; QVersionNumber v2;
v2 = qMove(v1); v2 = std::move(v1);
QCOMPARE(v2, QVersionNumber(1, 2, 3)); QCOMPARE(v2, QVersionNumber(1, 2, 3));
} }
// QVersionNumber(QVector<int> &&) // QVersionNumber(QVector<int> &&)
{ {
QVector<int> segments = QVector<int>() << 1 << 2 << 3; QVector<int> segments = QVector<int>() << 1 << 2 << 3;
QVersionNumber v1(segments); QVersionNumber v1(segments);
QVersionNumber v2(qMove(segments)); QVersionNumber v2(std::move(segments));
QVERIFY(!v1.isNull()); QVERIFY(!v1.isNull());
QVERIFY(!v2.isNull()); QVERIFY(!v2.isNull());
QCOMPARE(v1, v2); QCOMPARE(v1, v2);
@ -620,7 +620,7 @@ void tst_QVersionNumber::moveSemantics()
QVERIFY(!v.isNull()); QVERIFY(!v.isNull());
QVERIFY(!nv.isNull()); QVERIFY(!nv.isNull());
QVERIFY(nv.isNormalized()); QVERIFY(nv.isNormalized());
nv = qMove(v).normalized(); nv = std::move(v).normalized();
QVERIFY(!nv.isNull()); QVERIFY(!nv.isNull());
QVERIFY(nv.isNormalized()); QVERIFY(nv.isNormalized());
} }
@ -632,7 +632,7 @@ void tst_QVersionNumber::moveSemantics()
segments = v.segments(); segments = v.segments();
QVERIFY(!v.isNull()); QVERIFY(!v.isNull());
QVERIFY(!segments.empty()); QVERIFY(!segments.empty());
segments = qMove(v).segments(); segments = std::move(v).segments();
QVERIFY(!segments.empty()); QVERIFY(!segments.empty());
} }
#endif #endif

View File

@ -3403,7 +3403,7 @@ void tst_QImage::ditherGradient_data()
QTest::newRow("rgb32 -> rgb666 (dithering)") << rgb32 << QImage::Format_RGB666 << int(Qt::PreferDither | Qt::OrderedDither) << 129; 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. // 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 -> 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 -> 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; QTest::newRow("argb32pm -> argb4444pm (dithering)") << rgb32 << QImage::Format_ARGB4444_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 33;

View File

@ -148,14 +148,14 @@ void tst_QPalette::moveSemantics()
QCOMPARE(src, control); QCOMPARE(src, control);
QVERIFY(!dst.isCopyOf(src)); QVERIFY(!dst.isCopyOf(src));
QVERIFY(!dst.isCopyOf(control)); 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(src)); // isCopyOf() works on moved-from palettes, too
QVERIFY(dst.isCopyOf(control)); QVERIFY(dst.isCopyOf(control));
QCOMPARE(dst, control); QCOMPARE(dst, control);
src = control; // check moved-from 'src' can still be assigned to (doesn't crash) src = control; // check moved-from 'src' can still be assigned to (doesn't crash)
QVERIFY(src.isCopyOf(dst)); QVERIFY(src.isCopyOf(dst));
QVERIFY(src.isCopyOf(control)); QVERIFY(src.isCopyOf(control));
QPalette dst2(qMove(src)); // move construction QPalette dst2(std::move(src)); // move construction
QVERIFY(!src.isCopyOf(dst)); QVERIFY(!src.isCopyOf(dst));
QVERIFY(!src.isCopyOf(dst2)); QVERIFY(!src.isCopyOf(dst2));
QVERIFY(!src.isCopyOf(control)); QVERIFY(!src.isCopyOf(control));

View File

@ -95,7 +95,7 @@ void tst_QPen::move()
QPen p1(Qt::black); QPen p1(Qt::black);
// check that moving does the right thing: // 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)); QCOMPARE(p2.color(), QColor(Qt::black));
// this, executed ehre, would crash: // this, executed ehre, would crash:
@ -110,7 +110,7 @@ void tst_QPen::move()
QCOMPARE(p1.color(), QColor(Qt::yellow)); QCOMPARE(p1.color(), QColor(Qt::yellow));
// check that moved-from QPens p2, p3 can still be safely destroyed: // 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 // intentionally no more statements beyond this point
} }
@ -120,7 +120,7 @@ void tst_QPen::move_assign()
QPen p1(Qt::black), p2(Qt::white); QPen p1(Qt::black), p2(Qt::white);
// check that moving does the right thing: // 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)); QCOMPARE(p2.color(), QColor(Qt::black));
// check that move-assigned-from QPen p1 can still be used, albeit // 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: // check that moved-from QPens p2, p3 can still be safely destroyed:
QPen p5; QPen p5;
p5 = qMove(p2); p5 = std::move(p2);
// intentionally no more statements beyond this point // intentionally no more statements beyond this point
} }

View File

@ -131,7 +131,7 @@ void tst_QNetworkDatagram::makeReply()
QNetworkDatagram copy = dgram; QNetworkDatagram copy = dgram;
copy.setData(copy.data()); copy.setData(copy.data());
{ {
QNetworkDatagram reply = qMove(copy).makeReply("World"); QNetworkDatagram reply = std::move(copy).makeReply("World");
QCOMPARE(reply.data(), QByteArray("World")); QCOMPARE(reply.data(), QByteArray("World"));
QCOMPARE(reply.senderAddress(), QHostAddress(localAddress)); QCOMPARE(reply.senderAddress(), QHostAddress(localAddress));
QCOMPARE(reply.senderPort(), localAddress.isEmpty() ? -1 : dgram.destinationPort()); QCOMPARE(reply.senderPort(), localAddress.isEmpty() ? -1 : dgram.destinationPort());

View File

@ -252,7 +252,7 @@ class QTestTranslator : public QTranslator
{ {
const QString m_str; const QString m_str;
public: 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 QString translate(const char *, const char *sourceText, const char *, int) const override
{ return m_str + sourceText + m_str; } { return m_str + sourceText + m_str; }
@ -265,7 +265,7 @@ class QTranslatorGuard {
Translator t; Translator t;
public: public:
template <typename Arg> template <typename Arg>
explicit QTranslatorGuard(Arg a) : t(qMove(a)) explicit QTranslatorGuard(Arg a) : t(std::move(a))
{ qApp->installTranslator(&t); } { qApp->installTranslator(&t); }
~QTranslatorGuard() ~QTranslatorGuard()
{ qApp->removeTranslator(&t); } { qApp->removeTranslator(&t); }

View File

@ -357,10 +357,10 @@ void tst_QImageConversion::convertGenericInplace()
QFETCH(QImage::Format, outputFormat); QFETCH(QImage::Format, outputFormat);
QImage::Format inputFormat = inputImage.format(); QImage::Format inputFormat = inputImage.format();
QImage tmpImage = qMove(inputImage); QImage tmpImage = std::move(inputImage);
QBENCHMARK { QBENCHMARK {
tmpImage = (qMove(tmpImage).convertToFormat(outputFormat)).convertToFormat(inputFormat); tmpImage = (std::move(tmpImage).convertToFormat(outputFormat)).convertToFormat(inputFormat);
} }
} }