mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
DiveImportedModel: be consistent with last = -1
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
fd96daca6a
commit
f67b3a9852
1 changed files with 5 additions and 7 deletions
|
@ -139,26 +139,24 @@ void DiveImportedModel::clearTable()
|
|||
|
||||
void DiveImportedModel::setImportedDivesIndexes(int first, int last)
|
||||
{
|
||||
Q_ASSERT(last >= first);
|
||||
if (lastIndex >= firstIndex) {
|
||||
beginRemoveRows(QModelIndex(), 0, lastIndex - firstIndex);
|
||||
endRemoveRows();
|
||||
}
|
||||
beginInsertRows(QModelIndex(), 0, last - first);
|
||||
if (last >= first)
|
||||
beginInsertRows(QModelIndex(), 0, last - first);
|
||||
lastIndex = last;
|
||||
firstIndex = first;
|
||||
delete[] checkStates;
|
||||
checkStates = new bool[last - first + 1];
|
||||
memset(checkStates, true, last - first + 1);
|
||||
endInsertRows();
|
||||
if (last >= first)
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
void DiveImportedModel::repopulate()
|
||||
{
|
||||
if (diveTable->nr)
|
||||
setImportedDivesIndexes(0, diveTable->nr-1);
|
||||
else
|
||||
setImportedDivesIndexes(0, 0);
|
||||
setImportedDivesIndexes(0, diveTable->nr-1);
|
||||
}
|
||||
|
||||
void DiveImportedModel::recordDives()
|
||||
|
|
Loading…
Add table
Reference in a new issue