QSqlTableModel::indexInQuery(): fix for inserted rows
Should return invalid QModelIndex since inserted row does not map to query. Change-Id: Ib1d15cf4198a7063717fb3f3b594b2b1d8a54dfe Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>bb10
parent
76fa96b99e
commit
22e0060e59
|
|
@ -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()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue