From cdc9422c2e8b3ebb711085c0813b4477863ec01f Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Thu, 8 Mar 2012 00:19:03 +0100 Subject: QSqlTableModel::indexInQuery: fix inserted row accounting Commit b979956ec46093e5668c2b264f9b68da3cbb0326 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 --- src/sql/models/qsqltablemodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index d39df1d710..5fed167070 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -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()); -- cgit v1.2.3