do not remove if not count

This commit is contained in:
Hamed.Masafi 2019-06-23 18:37:06 +04:30
parent a7678b2a2a
commit 9413c882dc
1 changed files with 5 additions and 3 deletions

View File

@ -101,9 +101,11 @@ QVariant SqlModel::data(const QModelIndex &index, int role) const
void SqlModel::setRows(RowList<Table> rows)
{
d.detach();
if (d->rows.count()) {
beginRemoveRows(QModelIndex(), 0, d->rows.count());
d->rows.clear();
endRemoveRows();
}
beginInsertRows(QModelIndex(), 0, rows.count());
d->rows = rows;
endInsertRows();