diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-07-17 22:43:10 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-28 07:31:11 -0700 |
commit | ffb92111e5145d77f0d9b5be479a7a9283223407 (patch) | |
tree | b37537d7a0d48c19fb8b2d5255c76dedff07fec3 /mobile-widgets/qmlmapwidgethelper.cpp | |
parent | f44645b6fe3de4d117fe85d1f2ae7a01ac34b252 (diff) | |
download | subsurface-ffb92111e5145d77f0d9b5be479a7a9283223407.tar.gz |
mapwidgethelper: add the reloadMapLocations() method
reloadMapLocations() is the method which is called when the list
of markers (model) should be cleared and re-populated with new MapLocation
objects.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'mobile-widgets/qmlmapwidgethelper.cpp')
-rw-r--r-- | mobile-widgets/qmlmapwidgethelper.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmapwidgethelper.cpp b/mobile-widgets/qmlmapwidgethelper.cpp index 3a0e4aa71..c560c5aaf 100644 --- a/mobile-widgets/qmlmapwidgethelper.cpp +++ b/mobile-widgets/qmlmapwidgethelper.cpp @@ -23,3 +23,18 @@ void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds) Q_ARG(QVariant, latitude),
Q_ARG(QVariant, longitude));
}
+
+void MapWidgetHelper::reloadMapLocations()
+{
+ struct dive_site *ds;
+ int idx;
+ m_mapLocationModel->clear();
+
+ for_each_dive_site(idx, ds) {
+ if (!dive_site_has_gps_location(ds))
+ continue;
+ const qreal longitude = ds->longitude.udeg / 1000000.0;
+ const qreal latitude = ds->latitude.udeg / 1000000.0;
+ m_mapLocationModel->add(new MapLocation(QGeoCoordinate(latitude, longitude)));
+ }
+}
|