diff options
Diffstat (limited to 'src/sql')
-rw-r--r-- | src/sql/models/qsqltablemodel.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index b21a965c21..932bbbfd6b 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -1143,6 +1143,9 @@ 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) + return QModelIndex(); + const int rowOffset = d->insertCount(item.row()); return QSqlQueryModel::indexInQuery(createIndex(item.row() - rowOffset, item.column(), item.internalPointer())); } |