QSqlIndex: implement member swap() and use a macro for move-assignment

Also declare the type as shared using Q_DECLARE_SHARED

Found during Qt 6.6 API review.

This commit amends 46e909a37a.

[ChangeLog][QtSql] QSqlIndex is now a relocatable type.

Pick-to: 6.6
Change-Id: I78394cba082b4df2e4d8a6aab8e8e87f2340962c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Ivan Solovev 2023-08-21 17:06:02 +02:00 committed by Marc Mutz
parent 2f87711913
commit f081578ce0

View File

@ -20,7 +20,14 @@ public:
QSqlIndex(QSqlIndex &&other) noexcept = default;
~QSqlIndex();
QSqlIndex &operator=(const QSqlIndex &other);
QSqlIndex &operator=(QSqlIndex &&other) = default;
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QSqlIndex)
void swap(QSqlIndex &other) noexcept {
QSqlRecord::swap(other);
cursor.swap(other.cursor);
nm.swap(other.nm);
sorts.swap(other.sorts);
};
void setCursorName(const QString &cursorName);
inline QString cursorName() const { return cursor; }
@ -41,6 +48,8 @@ private:
QList<bool> sorts;
};
Q_DECLARE_SHARED(QSqlIndex)
QT_END_NAMESPACE
#endif // QSQLINDEX_H