summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2023-08-21 17:06:02 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-08-23 14:21:57 +0000
commitf081578ce097e5b437a0b1beee84f7056e9099f8 (patch)
treea7930c587ddaabe6d11faefacdbb952dd97ebfa7
parent2f8771191369b19d05971a135700ad9c17f11063 (diff)
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 46e909a37a38289a601333ae6f205e8946152287. [ChangeLog][QtSql] QSqlIndex is now a relocatable type. Pick-to: 6.6 Change-Id: I78394cba082b4df2e4d8a6aab8e8e87f2340962c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
-rw-r--r--src/sql/kernel/qsqlindex.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/sql/kernel/qsqlindex.h b/src/sql/kernel/qsqlindex.h
index 67eeb2a9e0..f011e64353 100644
--- a/src/sql/kernel/qsqlindex.h
+++ b/src/sql/kernel/qsqlindex.h
@@ -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