do not remove if not count
This commit is contained in:
parent
a7678b2a2a
commit
9413c882dc
|
|
@ -101,9 +101,11 @@ QVariant SqlModel::data(const QModelIndex &index, int role) const
|
||||||
void SqlModel::setRows(RowList<Table> rows)
|
void SqlModel::setRows(RowList<Table> rows)
|
||||||
{
|
{
|
||||||
d.detach();
|
d.detach();
|
||||||
beginRemoveRows(QModelIndex(), 0, d->rows.count());
|
if (d->rows.count()) {
|
||||||
d->rows.clear();
|
beginRemoveRows(QModelIndex(), 0, d->rows.count());
|
||||||
endRemoveRows();
|
d->rows.clear();
|
||||||
|
endRemoveRows();
|
||||||
|
}
|
||||||
beginInsertRows(QModelIndex(), 0, rows.count());
|
beginInsertRows(QModelIndex(), 0, rows.count());
|
||||||
d->rows = rows;
|
d->rows = rows;
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue