dive models: add helper role to find trip above or below dive

This is only used in the mobile UI where the sort direction is fixed and we
refer to dives based on the tree model. So the terms used and the concepts
that these rely on should be guaranteed to be valid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-02-20 13:22:57 -08:00
parent 0cd275af67
commit ccf5bf6445
4 changed files with 36 additions and 3 deletions

View file

@ -77,7 +77,6 @@ public:
// Used for sorting. This is a bit of a layering violation, as sorting should be performed
// by the higher-up QSortFilterProxyModel, but it makes things so much easier!
virtual bool lessThan(const QModelIndex &i1, const QModelIndex &i2) const = 0;
signals:
// The propagation of selection changes is complex.
// The control flow of dive-selection goes:
@ -120,6 +119,7 @@ public slots:
public:
DiveTripModelTree(QObject *parent = nullptr);
int tripInDirection(const struct dive *d, int direction) const;
private:
int rowCount(const QModelIndex &parent) const override;
void clearData() override;