summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/maplocationmodel.cpp9
-rw-r--r--qt-models/maplocationmodel.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/qt-models/maplocationmodel.cpp b/qt-models/maplocationmodel.cpp
index 0fe86f596..ea7d4f098 100644
--- a/qt-models/maplocationmodel.cpp
+++ b/qt-models/maplocationmodel.cpp
@@ -150,6 +150,15 @@ static bool hasSelectedDive(const dive_site *ds)
[] (const dive *d) { return d->selected; });
}
+void MapLocationModel::selectionChanged()
+{
+ if (m_mapLocations.isEmpty())
+ return;
+ for(MapLocation *m: m_mapLocations)
+ m->m_selected = m_selectedDs.contains(m->divesite());
+ emit dataChanged(createIndex(0, 0), createIndex(m_mapLocations.size() - 1, 0));
+}
+
void MapLocationModel::reload(QObject *map)
{
beginResetModel();
diff --git a/qt-models/maplocationmodel.h b/qt-models/maplocationmodel.h
index 8cec08818..25ae159bd 100644
--- a/qt-models/maplocationmodel.h
+++ b/qt-models/maplocationmodel.h
@@ -67,6 +67,7 @@ public:
void add(MapLocation *);
// 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();
MapLocation *getMapLocation(const struct dive_site *ds);
const QVector<dive_site *> &selectedDs() const;
Q_INVOKABLE void setSelected(struct dive_site *ds);