summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDheerendra Purohit <[email protected]>2025-04-30 17:32:18 +0530
committerDheerendra Purohit <[email protected]>2025-07-04 18:32:23 +0530
commit6733f3893caa2e195613690fccc5ec86fd8a118c (patch)
tree383e71286452c325aedb95754b1ee6419a952d9f
parent54dc4c1b9f35fb19b94214f2e48ba518175f32b4 (diff)
QSqlQueryModel::setLastError should be constHEADdev
The setLastError() function only modifies the mutable member d->error, so it can safely be marked as const. This change allows setLastError() to be called from other const member functions. Fixes: QTBUG-136490 Change-Id: I62999a2696b1742208745890a76769f8977918cc Reviewed-by: Axel Spoerl <[email protected]>
-rw-r--r--src/sql/models/qsqlquerymodel.cpp4
-rw-r--r--src/sql/models/qsqlquerymodel.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp
index d8e10343854..6f4611d9139 100644
--- a/src/sql/models/qsqlquerymodel.cpp
+++ b/src/sql/models/qsqlquerymodel.cpp
@@ -561,9 +561,9 @@ QSqlError QSqlQueryModel::lastError() const
\sa lastError()
*/
-void QSqlQueryModel::setLastError(const QSqlError &error)
+void QSqlQueryModel::setLastError(const QSqlError &error) const
{
- Q_D(QSqlQueryModel);
+ Q_D(const QSqlQueryModel);
d->error = error;
}
diff --git a/src/sql/models/qsqlquerymodel.h b/src/sql/models/qsqlquerymodel.h
index 72b9b053f03..24877118865 100644
--- a/src/sql/models/qsqlquerymodel.h
+++ b/src/sql/models/qsqlquerymodel.h
@@ -79,7 +79,7 @@ protected:
virtual void queryChange();
virtual QModelIndex indexInQuery(const QModelIndex &item) const;
- void setLastError(const QSqlError &error);
+ void setLastError(const QSqlError &error) const;
QSqlQueryModel(QSqlQueryModelPrivate &dd, QObject *parent = nullptr);
};