selection: trickle down trip selection

The trip selection code was an awkward layering violation.
Whereas dive selections due to dive undo-commands trickled
down via DiveTripModel-->MultiFilterSortModel-->DiveListView,
for trip editing, the DiveListView directly intercepted the
TripEdited signal.

Instead, mimic the dive-selection code. This is a bit longer
but more consistent and logical. The undo/redo of trip changes
is now also a "programmatical" change of the selection.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-08-27 17:28:34 +02:00 committed by bstoeger
parent 9ccb940a1b
commit 8581e213ed
11 changed files with 113 additions and 57 deletions

View file

@ -85,6 +85,7 @@ signals:
// indices into local indices according to current sorting/filtering and instructs the QSelectionModel to
// perform the appropriate actions.
void selectionChanged(const QVector<QModelIndex> &indices, QModelIndex currentDive);
void tripSelected(QModelIndex trip, QModelIndex currentDive);
protected:
dive *oldCurrent;
QBrush invalidForeground;
@ -116,6 +117,7 @@ public slots:
void diveChanged(dive *d);
void divesTimeChanged(timestamp_t delta, const QVector<dive *> &dives);
void divesSelected(const QVector<dive *> &dives, dive *currentDive);
void tripSelected(dive_trip *trip, dive *currentDive);
void tripChanged(dive_trip *trip, TripField);
void filterReset();
@ -194,6 +196,7 @@ public slots:
// Does nothing in list view.
//void divesMovedBetweenTrips(dive_trip *from, dive_trip *to, bool deleteFrom, bool createTo, const QVector<dive *> &dives);
void divesSelected(const QVector<dive *> &dives, dive *currentDive);
void tripSelected(dive_trip *trip, dive *currentDive);
void filterReset();
public: