QSqlTableModel: remove a call to cache.empty()

The call to the const `empty()` didn't do anything, because its results
were unused. Since this code has not been touched for some ~13 years,
just drop the call. (Probably clear() was intended, however doing that
change makes the corresponding autotest fail.)

Aggressively cherry-picking because I want to also cherry pick
[[nodiscard]] on empty() (which would've found this bug N years ago.)

Change-Id: I801d0c364a7122bb26d407c23ae99278939c50ff
Pick-to: 6.5
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 95c55d6f3216bfeb6d802fb70e455849b8c3567f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Botond István Horváth 2024-08-15 13:07:19 +02:00 committed by Qt Cherry-pick Bot
parent 9399ffd301
commit 3210c4c691

View File

@ -1108,9 +1108,6 @@ bool QSqlTableModel::insertRows(int row, int count, const QModelIndex &parent)
d->busyInsertingRows = true;
beginInsertRows(parent, row, row + count - 1);
if (d->strategy != OnManualSubmit)
d->cache.empty();
if (!d->cache.isEmpty()) {
QMap<int, QSqlTableModelPrivate::ModifiedRow>::Iterator it = d->cache.end();
while (it != d->cache.begin() && (--it).key() >= row) {