summaryrefslogtreecommitdiffstats
path: root/qt-models/divelistmodel.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-30 10:09:46 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-30 10:09:46 -0800
commit2f2e9da2cd18d0450fa791371922ba1844338bb6 (patch)
tree4f774b1f37a1f9ad7546896f0d16088b26a77833 /qt-models/divelistmodel.cpp
parent9d6225831650dd9c6331763d29b392bc2741ae4e (diff)
downloadsubsurface-2f2e9da2cd18d0450fa791371922ba1844338bb6.tar.gz
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>
Diffstat (limited to 'qt-models/divelistmodel.cpp')
-rw-r--r--qt-models/divelistmodel.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp
index 7d49f5c01..18f270c15 100644
--- a/qt-models/divelistmodel.cpp
+++ b/qt-models/divelistmodel.cpp
@@ -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();