Selection: automatically unselect old selection in selectDives()

DiveListView::selectDives() would only select new dives but not clear
the old selection. Thus, callers would have to clear the selection
first. That would lead to two selection-changed signals.

Move the unselectDives() call into DiveListView::selectDives().
The DiveListView has an internal flag to prevent double signals.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-05-03 22:17:03 +02:00 committed by Dirk Hohndel
parent 8eb586d1d4
commit 403206ca06
2 changed files with 8 additions and 9 deletions

View file

@ -105,11 +105,7 @@ void MapWidget::prepareForGetDiveCoordinates(struct dive_site *ds)
void MapWidget::selectedDivesChanged(const QList<int> &list)
{
CHECK_IS_READY_RETURN_VOID();
skipReload = true;
MainWindow::instance()->diveList->unselectDives();
if (!list.empty())
MainWindow::instance()->diveList->selectDives(list);
skipReload = false;
MainWindow::instance()->diveList->selectDives(list);
}
void MapWidget::coordinatesChanged(struct dive_site *ds, const location_t &location)