summaryrefslogtreecommitdiffstats
path: root/src/sql/kernel/qsqlquery.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql/kernel/qsqlquery.h')
-rw-r--r--src/sql/kernel/qsqlquery.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/sql/kernel/qsqlquery.h b/src/sql/kernel/qsqlquery.h
index b2704412738..b34452c3027 100644
--- a/src/sql/kernel/qsqlquery.h
+++ b/src/sql/kernel/qsqlquery.h
@@ -61,10 +61,29 @@ public:
explicit QSqlQuery(QSqlResult *r);
explicit QSqlQuery(const QString& query = QString(), const QSqlDatabase &db = QSqlDatabase());
explicit QSqlQuery(const QSqlDatabase &db);
- QSqlQuery(const QSqlQuery& other);
- QSqlQuery& operator=(const QSqlQuery& other);
+
+#if QT_DEPRECATED_SINCE(6, 2)
+ QT_DEPRECATED_VERSION_X_6_2("QSqlQuery is not meant to be copied. Use move construction instead.")
+ QSqlQuery(const QSqlQuery &other);
+ QT_DEPRECATED_VERSION_X_6_2("QSqlQuery is not meant to be copied. Use move assignment instead.")
+ QSqlQuery& operator=(const QSqlQuery &other);
+#else
+ QSqlQuery(const QSqlQuery &other) = delete;
+ QSqlQuery& operator=(const QSqlQuery &other) = delete;
+#endif
+
+ QSqlQuery(QSqlQuery &&other) noexcept
+ : d(std::exchange(other.d, nullptr))
+ {}
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QSqlQuery)
+
~QSqlQuery();
+ void swap(QSqlQuery &other) noexcept
+ {
+ qSwap(d, other.d);
+ }
+
bool isValid() const;
bool isActive() const;
bool isNull(int field) const;