summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-08-30 17:55:54 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-09-06 11:48:47 -0700
commitb7665251835cb6786c3b268fd0d04d69dccf36ed (patch)
tree4765a41e0194109394ad07cab2c3af2b4d0ede66 /desktop-widgets
parent488eb1542336088245841d79549e26938e2d3fd9 (diff)
downloadsubsurface-b7665251835cb6786c3b268fd0d04d69dccf36ed.tar.gz
Selection: properly update selection flag of map location
Owing to the recent changes, when the selection flag in the MapLocationModel was not updated correctly when the user manually selected the dive. Do that before raising the divesSelected signal in DiveListView::selectionChanged() because that will cause the MainWindow to repaint the flags. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/divelistview.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp
index 489929bc6..fffb1186f 100644
--- a/desktop-widgets/divelistview.cpp
+++ b/desktop-widgets/divelistview.cpp
@@ -687,8 +687,20 @@ void DiveListView::selectionChanged(const QItemSelection &selected, const QItemS
select_dive(dive);
}
}
- if (!dontEmitDiveChangedSignal)
+ if (!dontEmitDiveChangedSignal) {
+ // When receiving the divesSelected signal the main window will
+ // instruct the map to update the flags. Thus, make sure that
+ // the selected maps are registered correctly.
+ QVector<dive_site *> selectedSites;
+ for (QModelIndex index: selectionModel()->selection().indexes()) {
+ const QAbstractItemModel *model = index.model();
+ struct dive *dive = model->data(index, DiveTripModelBase::DIVE_ROLE).value<struct dive *>();
+ if (dive && dive->dive_site)
+ selectedSites.push_back(dive->dive_site);
+ }
+ MapWidget::instance()->setSelected(selectedSites);
emit divesSelected();
+ }
// Display the new, processed, selection
QTreeView::selectionChanged(selectionModel()->selection(), newDeselected);