summaryrefslogtreecommitdiffstats
path: root/src/sql/models/qsqlquerymodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql/models/qsqlquerymodel.cpp')
-rw-r--r--src/sql/models/qsqlquerymodel.cpp71
1 files changed, 14 insertions, 57 deletions
diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp
index ceada8cae2..6f91fb9739 100644
--- a/src/sql/models/qsqlquerymodel.cpp
+++ b/src/sql/models/qsqlquerymodel.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSql module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qsqlquerymodel.h"
#include "qsqlquerymodel_p.h"
@@ -46,6 +10,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#define QSQL_PREFETCH 255
void QSqlQueryModelPrivate::prefetch(int limit)
@@ -173,8 +139,6 @@ QSqlQueryModel::~QSqlQueryModel()
}
/*!
- \since 4.1
-
Fetches more rows from a database.
This only affects databases that don't report back the size of a query
(see QSqlDriver::hasFeature()).
@@ -196,8 +160,6 @@ void QSqlQueryModel::fetchMore(const QModelIndex &parent)
}
/*!
- \since 4.1
-
Returns \c true if it is possible to read more rows from the database.
This only affects databases that don't report back the size of a query
(see QSqlDriver::hasFeature()).
@@ -329,7 +291,6 @@ void QSqlQueryModel::endResetModel()
}
/*! \fn int QSqlQueryModel::rowCount(const QModelIndex &parent) const
- \since 4.1
If the database supports returning the size of a query
(see QSqlDriver::hasFeature()), the number of rows of the current
@@ -418,19 +379,17 @@ void QSqlQueryModel::queryChange()
// do nothing
}
-
+#if QT_DEPRECATED_SINCE(6, 2)
/*!
- \obsolete
+ \deprecated [6.2] Use the \c{setQuery(QSqlQuery &&query)} overload instead.
\overload
- \since 4.5
-
- Use the \c{setQuery(QSqlQuery &&query)} overload instead.
*/
void QSqlQueryModel::setQuery(const QSqlQuery &query)
{
QT_IGNORE_DEPRECATIONS(QSqlQuery copy = query;)
setQuery(std::move(copy));
}
+#endif // QT_DEPRECATED_SINCE(6, 2)
/*!
Resets the model and sets the data provider to be the given \a
@@ -464,8 +423,7 @@ void QSqlQueryModel::setQuery(QSqlQuery &&query)
d->atEnd = true;
if (d->query.isForwardOnly()) {
- d->error = QSqlError(QLatin1String("Forward-only queries "
- "cannot be used in a data model"),
+ d->error = QSqlError("Forward-only queries cannot be used in a data model"_L1,
QString(), QSqlError::ConnectionError);
endResetModel();
return;
@@ -557,18 +515,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
@@ -663,7 +618,7 @@ bool QSqlQueryModel::insertColumns(int column, int count, const QModelIndex &par
d->colOffsets.append(nVal);
Q_ASSERT(d->colOffsets.size() >= d->rec.count());
}
- for (int i = column + 1; i < d->colOffsets.count(); ++i)
+ for (int i = column + 1; i < d->colOffsets.size(); ++i)
++d->colOffsets[i];
}
endInsertColumns();
@@ -692,7 +647,7 @@ bool QSqlQueryModel::removeColumns(int column, int count, const QModelIndex &par
int i;
for (i = 0; i < count; ++i)
d->rec.remove(column);
- for (i = column; i < d->colOffsets.count(); ++i)
+ for (i = column; i < d->colOffsets.size(); ++i)
d->colOffsets[i] -= count;
endRemoveColumns();
@@ -721,3 +676,5 @@ QModelIndex QSqlQueryModel::indexInQuery(const QModelIndex &item) const
}
QT_END_NAMESPACE
+
+#include "moc_qsqlquerymodel.cpp"