mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add helper functions to identify the position of a dive in the dive list
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b275e604c1
commit
3b37844708
4 changed files with 20 additions and 0 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue