diff --git a/src/sql/compat/removed_api.cpp b/src/sql/compat/removed_api.cpp index 1ada26407a..cab5d5b528 100644 --- a/src/sql/compat/removed_api.cpp +++ b/src/sql/compat/removed_api.cpp @@ -17,6 +17,18 @@ QT_USE_NAMESPACE #if QT_SQL_REMOVED_SINCE(6, 5) +#if QT_CONFIG(sqlmodel) + +#include "qsqlquerymodel.h" +#include "qsqlquery.h" + +QSqlQuery QSqlQueryModel::query() const +{ + QT_IGNORE_DEPRECATIONS(return query(QT6_CALL_NEW_OVERLOAD);) +} + +#endif // QT_CONFIG(sqlmodel) + // #include // // implement removed functions from qotherheader.h // order sections alphabetically to reduce chances of merge conflicts diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp index 61620f81d4..fee99bd8ea 100644 --- a/src/sql/models/qsqlquerymodel.cpp +++ b/src/sql/models/qsqlquerymodel.cpp @@ -522,18 +522,15 @@ bool QSqlQueryModel::setHeaderData(int section, Qt::Orientation orientation, } /*! - Returns the QSqlQuery associated with this model. + Returns a reference to the const QSqlQuery object associated with this model. \sa setQuery() */ -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED -QSqlQuery QSqlQueryModel::query() const +const QSqlQuery &QSqlQueryModel::query(QT6_IMPL_NEW_OVERLOAD) const { Q_D(const QSqlQueryModel); return d->query; } -QT_WARNING_POP /*! Returns information about the last error that occurred on the diff --git a/src/sql/models/qsqlquerymodel.h b/src/sql/models/qsqlquerymodel.h index ede97b04fb..73308b79e8 100644 --- a/src/sql/models/qsqlquerymodel.h +++ b/src/sql/models/qsqlquerymodel.h @@ -46,7 +46,10 @@ public: #endif void setQuery(QSqlQuery &&query); void setQuery(const QString &query, const QSqlDatabase &db = QSqlDatabase()); +#if QT_SQL_REMOVED_SINCE(6, 5) QSqlQuery query() const; +#endif + const QSqlQuery &query(QT6_DECL_NEW_OVERLOAD) const; virtual void clear();