Clear the Dive model before repopulating it

Otherwise we could get duplicate dives in the dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-11-30 10:09:46 -08:00
parent 9d62258316
commit 2f2e9da2cd
3 changed files with 9 additions and 0 deletions

View file

@ -15,6 +15,13 @@ void DiveListModel::addDive(dive *d)
endInsertRows();
}
void DiveListModel::clear()
{
beginRemoveRows(QModelIndex(), 0, m_dives.count() - 1);
m_dives.clear();
endRemoveRows();
}
int DiveListModel::rowCount(const QModelIndex &) const
{
return m_dives.count();