QSqlTableModel::indexInQuery: fix inserted row accounting

Commit b979956ec4 introduced a
distinction between rows that have a pending INSERT operation and
rows that have already been inserted in the database but still are
in the change cache. Both cases are rows that are not in the underlying
query. Unfortunately, we overlooked a case where the point of the test
is whether the row is in the query.

Change-Id: I0f58bed232d9336fed6e67c3d140fd580ec35868
Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
This commit is contained in:
Mark Brand 2012-03-08 00:19:03 +01:00 committed by Qt by Nokia
parent 4c0de07a0e
commit cdc9422c2e

View File

@ -1163,7 +1163,7 @@ int QSqlTableModel::rowCount(const QModelIndex &parent) const
QModelIndex QSqlTableModel::indexInQuery(const QModelIndex &item) const
{
Q_D(const QSqlTableModel);
if (d->cache.value(item.row()).op() == QSqlTableModelPrivate::Insert)
if (d->cache.value(item.row()).insert())
return QModelIndex();
const int rowOffset = d->insertCount(item.row());