mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
9771255919
commit
89ccdc3178
1 changed files with 1 additions and 3 deletions
|
@ -231,11 +231,9 @@ void MapWidgetHelper::setEditMode(bool editMode)
|
||||||
MapLocation *exists = m_mapLocationModel->getMapLocationForUuid(displayed_dive_site.uuid);
|
MapLocation *exists = m_mapLocationModel->getMapLocationForUuid(displayed_dive_site.uuid);
|
||||||
// if divesite uuid doesn't exist in the model, add a new MapLocation.
|
// if divesite uuid doesn't exist in the model, add a new MapLocation.
|
||||||
if (editMode && !exists) {
|
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,
|
m_mapLocationModel->add(new MapLocation(displayed_dive_site.uuid, coord,
|
||||||
QString(displayed_dive_site.name)));
|
QString(displayed_dive_site.name)));
|
||||||
QMetaObject::invokeMethod(m_map, "centerOnCoordinate",
|
|
||||||
Q_ARG(QVariant, QVariant::fromValue(coord)));
|
|
||||||
}
|
}
|
||||||
emit editModeChanged();
|
emit editModeChanged();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue