diff options
author | Mark Brand <mabrand@mabrand.nl> | 2012-03-08 00:19:03 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-12 13:14:05 +0100 |
commit | cdc9422c2e8b3ebb711085c0813b4477863ec01f (patch) | |
tree | 8414d6ca9293dc130e4397928c528c8b8e9cb710 | |
parent | 4c0de07a0e555c52680c5a45aef0121721f242ea (diff) |
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 <honglei.zhang@nokia.com>
-rw-r--r-- | src/sql/models/qsqltablemodel.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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()); |