summaryrefslogtreecommitdiffstats
path: root/map-widget/qmlmapwidgethelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'map-widget/qmlmapwidgethelper.cpp')
-rw-r--r--map-widget/qmlmapwidgethelper.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/map-widget/qmlmapwidgethelper.cpp b/map-widget/qmlmapwidgethelper.cpp
index e900debf1..d9d6312a7 100644
--- a/map-widget/qmlmapwidgethelper.cpp
+++ b/map-widget/qmlmapwidgethelper.cpp
@@ -238,11 +238,19 @@ void MapWidgetHelper::setEditMode(bool editMode)
{
m_editMode = editMode;
MapLocation *exists = m_mapLocationModel->getMapLocationForUuid(displayed_dive_site.uuid);
- // if divesite uuid doesn't exist in the model, add a new MapLocation.
- if (editMode && !exists) {
- QGeoCoordinate coord = m_map->property("center").value<QGeoCoordinate>();
- m_mapLocationModel->add(new MapLocation(displayed_dive_site.uuid, coord,
- QString(displayed_dive_site.name)));
+ if (editMode) {
+ QGeoCoordinate coord;
+ // if divesite uuid doesn't exist in the model, add a new MapLocation.
+ if (!exists) {
+ coord = m_map->property("center").value<QGeoCoordinate>();
+ m_mapLocationModel->add(new MapLocation(displayed_dive_site.uuid, coord,
+ QString(displayed_dive_site.name)));
+ } else {
+ coord = exists->coordinate();
+ }
+ displayed_dive_site.latitude.udeg = lrint(coord.latitude() * 1000000.0);
+ displayed_dive_site.longitude.udeg = lrint(coord.longitude() * 1000000.0);
+ emit coordinatesChanged();
}
emit editModeChanged();
}