summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/divelistview.cpp17
-rw-r--r--desktop-widgets/mapwidget.cpp6
-rw-r--r--desktop-widgets/mapwidget.h1
3 files changed, 24 insertions, 0 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp
index 19eeccb13..489929bc6 100644
--- a/desktop-widgets/divelistview.cpp
+++ b/desktop-widgets/divelistview.cpp
@@ -27,6 +27,7 @@
#include "qt-models/divepicturemodel.h"
#include "core/metrics.h"
#include "desktop-widgets/simplewidgets.h"
+#include "desktop-widgets/mapwidget.h"
DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false),
currentLayout(DiveTripModelBase::TREE), dontEmitDiveChangedSignal(false), selectionSaved(false),
@@ -455,6 +456,22 @@ void DiveListView::selectDives(const QList<int> &newDiveSelection)
scrollTo(idx.parent());
scrollTo(idx);
}
+
+ // update the selected-flag for the dive sites.
+ // the actual reloading of the dive sites will be perfomed
+ // by the main-window in response to the divesSelected signal
+ // emitted below.
+ QVector<dive_site *> selectedSites;
+ for (int idx: newDiveSelection) {
+ dive *d = get_dive(idx);
+ if (!d)
+ continue;
+ dive_site *ds = d->dive_site;
+ if (ds && !selectedSites.contains(ds))
+ selectedSites.append(ds);
+ }
+ MapWidget::instance()->setSelected(selectedSites);
+
// now that everything is up to date, update the widgets
emit divesSelected();
dontEmitDiveChangedSignal = false;
diff --git a/desktop-widgets/mapwidget.cpp b/desktop-widgets/mapwidget.cpp
index 376a29998..15fdef960 100644
--- a/desktop-widgets/mapwidget.cpp
+++ b/desktop-widgets/mapwidget.cpp
@@ -84,6 +84,12 @@ bool MapWidget::editMode() const
return isReady && m_mapHelper->editMode();
}
+void MapWidget::setSelected(const QVector<dive_site *> &divesites)
+{
+ CHECK_IS_READY_RETURN_VOID();
+ m_mapHelper->setSelected(divesites);
+}
+
void MapWidget::selectionChanged()
{
CHECK_IS_READY_RETURN_VOID();
diff --git a/desktop-widgets/mapwidget.h b/desktop-widgets/mapwidget.h
index 9e05ce48f..9ebf70c04 100644
--- a/desktop-widgets/mapwidget.h
+++ b/desktop-widgets/mapwidget.h
@@ -24,6 +24,7 @@ public:
static MapWidget *instance();
void reload();
void selectionChanged();
+ void setSelected(const QVector<dive_site *> &divesites);
bool editMode() const;
public slots: