Skip to content

Commit

Permalink
use remove rows signal rather than model reset
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBColton committed Aug 31, 2020
1 parent b2dba24 commit 0419c56
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Models/RepeatedModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ class RepeatedModel : public ProtoModel {
}
}

emit _model.beginResetModel();

// Basic dense range removal. Move "deleted" rows to the end of the array.
int left = 0, right = 0;
for (auto range : ranges) {
Expand All @@ -188,12 +186,12 @@ class RepeatedModel : public ProtoModel {
// correct number of rows incrementally, or else various components in Qt
// will bitch, piss, moan, wail, whine, and cry. Actually, they will anyway.
for (Range range : ranges) {
emit _model.beginRemoveRows(QModelIndex(), range.first, range.last);
_model.Resize(_field.size() - range.size());
for (int j = range.first; j <= range.last; ++j) _field.RemoveLast();
emit _model.endRemoveRows();
}

emit _model.endResetModel();

_model.ParentDataChanged();
}
};
Expand Down

0 comments on commit 0419c56

Please sign in to comment.