aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-08-30 17:38:54 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-09-06 11:48:47 -0700
commit488eb1542336088245841d79549e26938e2d3fd9 (patch)
treebba9ed5d849fa7ac8639078651582576b0ab4867 /qt-models
parentb39f2406c6a520f0b3743324744f3c55914adc52 (diff)
downloadsubsurface-488eb1542336088245841d79549e26938e2d3fd9.tar.gz
Desktop: show all selected dive sites on click
When clicking a dive site on the map, the QML code would set the selected dive site, but then all dives of dive sites in the vicinity were set. But still only the clicked-on dive site was shown. Therefore, don't set the list of selected dive sites in QML, but later in DiveListView::selectDives(), where we know all the dives that were selected. This, again, gives nasty entanglement of diverse widgets and models. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/maplocationmodel.cpp5
-rw-r--r--qt-models/maplocationmodel.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/qt-models/maplocationmodel.cpp b/qt-models/maplocationmodel.cpp
index ea7d4f098..10d983575 100644
--- a/qt-models/maplocationmodel.cpp
+++ b/qt-models/maplocationmodel.cpp
@@ -229,6 +229,11 @@ void MapLocationModel::setSelected(struct dive_site *ds)
m_selectedDs.append(ds);
}
+void MapLocationModel::setSelected(const QVector<dive_site *> &divesites)
+{
+ m_selectedDs = divesites;
+}
+
bool MapLocationModel::isSelected(const QVariant &dsVariant) const
{
dive_site *ds = dsVariant.value<dive_site *>();
diff --git a/qt-models/maplocationmodel.h b/qt-models/maplocationmodel.h
index 25ae159bd..3335822e2 100644
--- a/qt-models/maplocationmodel.h
+++ b/qt-models/maplocationmodel.h
@@ -68,6 +68,7 @@ public:
// If map is not null, it will be used to place new dive sites without GPS location at the center of the map
void reload(QObject *map);
void selectionChanged();
+ void setSelected(const QVector<dive_site *> &divesites);
MapLocation *getMapLocation(const struct dive_site *ds);
const QVector<dive_site *> &selectedDs() const;
Q_INVOKABLE void setSelected(struct dive_site *ds);