summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-11-09 16:11:13 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-11-09 12:40:25 -0800
commit89ccdc31784f37a4f29befd2f45a33f50a121dc0 (patch)
treea159a9435c6f56620449997ecf851cfe668aad62
parent97712559192ca82d10eba91fede6d432c404aadc (diff)
downloadsubsurface-89ccdc31784f37a4f29befd2f45a33f50a121dc0.tar.gz
map-widget: use current center when editing new markers
When starting to edit a new dive location, create a marker at the current map center instead of zooming out and centering on the 0,0 coordinate. This will help (and speed up) a lot the edition, if the user needs to add numerous dive markers at a specific location close to each other. refs #754 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
-rw-r--r--map-widget/qmlmapwidgethelper.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/map-widget/qmlmapwidgethelper.cpp b/map-widget/qmlmapwidgethelper.cpp
index ba197f63f..1c0469c4a 100644
--- a/map-widget/qmlmapwidgethelper.cpp
+++ b/map-widget/qmlmapwidgethelper.cpp
@@ -231,11 +231,9 @@ void MapWidgetHelper::setEditMode(bool 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(0.0, 0.0);
+ QGeoCoordinate coord = m_map->property("center").value<QGeoCoordinate>();
m_mapLocationModel->add(new MapLocation(displayed_dive_site.uuid, coord,
QString(displayed_dive_site.name)));
- QMetaObject::invokeMethod(m_map, "centerOnCoordinate",
- Q_ARG(QVariant, QVariant::fromValue(coord)));
}
emit editModeChanged();
}