Mobile: Map directly from source in DiveListSortModel::getIdxForId()

Instead of looping over all dives and search the dive with the given
id, let the source model determine the index and map that. Thus,
we do only one mapping and don't generate a ton of DiveObjectHelpers.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-08-13 21:31:53 +02:00 committed by bstoeger
parent 62f1a92068
commit 20e847f9d8
2 changed files with 16 additions and 7 deletions

View file

@ -58,6 +58,7 @@ public:
struct dive *getDive(int i);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int getDiveIdx(int id) const;
QModelIndex getDiveQIdx(int id);
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QHash<int, QByteArray> roleNames() const;
QString startAddDive();