mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Map: Use proper location for flag when editing dive site
When the dive site was not on the map because it had no dives, entering dive site edit mode would place the map at the center of the map, not at the location of the dive site. Use the location of the dive site unless it has no location. In that case use the map center. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
8c6205fc0d
commit
53c9d524ca
1 changed files with 3 additions and 1 deletions
|
@ -288,7 +288,9 @@ void MapWidgetHelper::enterEditMode(struct dive_site *ds)
|
|||
QGeoCoordinate coord;
|
||||
// if divesite doesn't exist in the model, add a new MapLocation.
|
||||
if (!exists) {
|
||||
coord = m_map->property("center").value<QGeoCoordinate>();
|
||||
// If the dive site doesn't have a GPS location, use the centre of the map
|
||||
coord = has_location(&ds->location) ? getCoordinates(ds)
|
||||
: m_map->property("center").value<QGeoCoordinate>();
|
||||
m_mapLocationModel->add(new MapLocation(ds, coord, QString(ds->name)));
|
||||
} else {
|
||||
coord = exists->coordinate();
|
||||
|
|
Loading…
Reference in a new issue