I had a qDebug() there because I thought earlier that I could create situations where things went wrong - now I was able to reproduce one. Merging to trips reliably put us in an inconsistent state. The code flow then actually happened to correct the issue, but I want to make sure this doesn't bite us some other time...
Tomaz, Thiago, can you look at this and tell me why clearSelection() doesn't appear to trigger the selectionChange() slot? /D commit 10e567515161f23510874236efd2f105c033ecec Author: Dirk Hohndel <[email protected]> Date: Sat May 24 13:55:18 2014 -0700 Dive list: work around odd problem with selections According to the documentation clearSelection() should emit selectionChanged() - but I can verify in the debugger that sometimes this doesn't appear to happen - consequently our notion of what's selected gets confused. To work around this, after calling clearSelection() we simply manuall deselect all dives. Signed-off-by: Dirk Hohndel <[email protected]> diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 91b3dadf5423..1f716ed57a70 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -190,8 +190,13 @@ void DiveListView::selectTrip(dive_trip_t *trip) void DiveListView::unselectDives() { selectionModel()->clearSelection(); - if (amount_selected != 0) - qDebug() << "selection information inconsistent"; + // clearSelection should emit selectionChanged() but sometimes that + // appears not to happen + int i; + struct dive *dive; + for_each_dive(i, dive) { + deselect_dive(i); + } } QList<dive_trip_t *> DiveListView::selectedTrips() _______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
