diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-04-01 22:42:07 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-04-12 18:19:07 +0300 |
commit | 53c9d524ca7038e2cb8a510ede9e3aea9648a326 (patch) | |
tree | ebe428c76d37076dae447a21dc93c09604b3877c | |
parent | 8c6205fc0d43af849769c11f8a8fb79396895ecc (diff) | |
download | subsurface-53c9d524ca7038e2cb8a510ede9e3aea9648a326.tar.gz |
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>
-rw-r--r-- | map-widget/qmlmapwidgethelper.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/map-widget/qmlmapwidgethelper.cpp b/map-widget/qmlmapwidgethelper.cpp index a0062db6b..aad201722 100644 --- a/map-widget/qmlmapwidgethelper.cpp +++ b/map-widget/qmlmapwidgethelper.cpp @@ -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(); |