Dive list: propagate current-item to frontend

The command-objects select a current item, but this selection
was not propagated to the front-end. The current item is the
base for keyboard-navigation through the dive-list and therefore
should be set correctly.

It took some experimentation to get the flags right:
 QItemSelectionModel::Current
Hopefully, these are the correct flags across all supported
Qt versions!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-08-14 09:12:21 -04:00 committed by Dirk Hohndel
parent b16be29595
commit 3c6cdfd8c0
6 changed files with 74 additions and 5 deletions

View file

@ -118,6 +118,7 @@ signals:
// indexes into local indexes according to current sorting/filtering and instructs the QSelectionModel to
// perform the appropriate actions.
void selectionChanged(const QVector<QModelIndex> &indexes, bool select);
void newCurrentDive(QModelIndex index);
private slots:
void divesAdded(dive_trip *trip, bool addTrip, const QVector<dive *> &dives);
void divesDeleted(dive_trip *trip, bool deleteTrip, const QVector<dive *> &dives);
@ -126,6 +127,7 @@ private slots:
void divesMovedBetweenTrips(dive_trip *from, dive_trip *to, bool deleteFrom, bool createTo, const QVector<dive *> &dives);
void divesSelected(dive_trip *trip, const QVector<dive *> &dives);
void divesDeselected(dive_trip *trip, const QVector<dive *> &dives);
void currentDiveChanged();
private:
// The model has up to two levels. At the top level, we have either trips or dives
// that do not belong to trips. Such a top-level item is represented by the "Item"