QSqlTableModel::selectRow(): reduce scope of QSqlQuery
It's good to clean up the query before emitting signals about the updated row. It's possible that connected slots will call selectRow() again for other rows. Change-Id: I482fe2dd58218f53567ce8725ee591ce2eeda348 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>bb10
parent
7389c09637
commit
3c2733e45f
|
|
@ -431,13 +431,15 @@ bool QSqlTableModel::selectRow(int row)
|
|||
d->sortColumn = table_sort_col;
|
||||
d->filter = table_filter;
|
||||
|
||||
QSqlQuery q(d->db);
|
||||
q.setForwardOnly(true);
|
||||
if (!q.exec(stmt))
|
||||
return false;
|
||||
{
|
||||
QSqlQuery q(d->db);
|
||||
q.setForwardOnly(true);
|
||||
if (!q.exec(stmt))
|
||||
return false;
|
||||
|
||||
bool exists = q.next();
|
||||
d->cache[row].refresh(exists, q.record());
|
||||
bool exists = q.next();
|
||||
d->cache[row].refresh(exists, q.record());
|
||||
}
|
||||
|
||||
emit headerDataChanged(Qt::Vertical, row, row);
|
||||
emit dataChanged(createIndex(row, 0), createIndex(row, columnCount() - 1));
|
||||
|
|
|
|||
Loading…
Reference in New Issue