summaryrefslogtreecommitdiffstats
path: root/qt-models/divelistmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models/divelistmodel.cpp')
-rw-r--r--qt-models/divelistmodel.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp
index bef2c5158..7e1844f3e 100644
--- a/qt-models/divelistmodel.cpp
+++ b/qt-models/divelistmodel.cpp
@@ -91,6 +91,16 @@ int DiveListModel::getDiveId(int idx) const
return m_dives[idx]->id();
}
+int DiveListModel::getDiveIdx(int id) const
+{
+ int i;
+ for (i = 0; i < m_dives.count(); i++) {
+ if (m_dives.at(i)->id() == id)
+ return i;
+ }
+ return -1;
+}
+
QVariant DiveListModel::data(const QModelIndex &index, int role) const
{
if(index.row() < 0 || index.row() > m_dives.count())