mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
488eb15423
commit
b766525183
1 changed files with 13 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue