From 89ccdc31784f37a4f29befd2f45a33f50a121dc0 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Thu, 9 Nov 2017 16:11:13 +0200 Subject: 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 --- map-widget/qmlmapwidgethelper.cpp | 4 +--- 1 file changed, 1 insertion(+), 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(); 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(); } -- cgit v1.2.3-70-g09d2