From ef98a4ff5ad05b3a1fc51ffb5996d49d1c462a75 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 9 Nov 2018 16:41:45 +0100 Subject: Dive list: keep dives-in-trip list ordered after shift-times On shift-times, the list of dives in a trip may become disordered. Reestablish order with sort_table(). Signed-off-by: Berthold Stoeger --- desktop-widgets/command_divelist.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'desktop-widgets/command_divelist.cpp') diff --git a/desktop-widgets/command_divelist.cpp b/desktop-widgets/command_divelist.cpp index d5fbc2139..2c474cf94 100644 --- a/desktop-widgets/command_divelist.cpp +++ b/desktop-widgets/command_divelist.cpp @@ -605,15 +605,17 @@ void ShiftTime::redoit() // Changing times may have unsorted the dive table sort_table(&dive_table); - // We send one dives-deleted signal per trip (see comments in DiveListNotifier.h). - // Therefore, collect all dives in a array and sort by trip. + // We send one time changed signal per trip (see comments in DiveListNotifier.h). + // Therefore, collect all dives in an array and sort by trip. std::vector> dives; dives.reserve(diveList.size()); for (dive *d: diveList) dives.push_back({ d->divetrip, d }); - // Send signals. + // Send signals and sort tables. processByTrip(dives, [&](dive_trip *trip, const QVector &divesInTrip) { + if (trip) + sort_table(&trip->dives); // Keep the trip-table in order emit diveListNotifier.divesTimeChanged(trip, timeChanged, divesInTrip); }); -- cgit v1.2.3-70-g09d2