aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmapwidgethelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mobile-widgets/qmlmapwidgethelper.cpp')
-rw-r--r--mobile-widgets/qmlmapwidgethelper.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/mobile-widgets/qmlmapwidgethelper.cpp b/mobile-widgets/qmlmapwidgethelper.cpp
index f0855e52d..7a17feaa0 100644
--- a/mobile-widgets/qmlmapwidgethelper.cpp
+++ b/mobile-widgets/qmlmapwidgethelper.cpp
@@ -22,11 +22,15 @@ MapWidgetHelper::MapWidgetHelper(QObject *parent) : QObject(parent)
void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds)
{
if (!dive_site_has_gps_location(ds)) {
+ m_mapLocationModel->setSelectedUuid(ds ? ds->uuid : 0, false);
QMetaObject::invokeMethod(m_map, "deselectMapLocation");
return;
}
- MapLocation *location = m_mapLocationModel->getMapLocationForUuid(ds->uuid);
- QMetaObject::invokeMethod(m_map, "centerOnMapLocation", Q_ARG(QVariant, QVariant::fromValue(location)));
+ m_mapLocationModel->setSelectedUuid(ds->uuid, false);
+ const qreal latitude = ds->latitude.udeg * 0.000001;
+ const qreal longitude = ds->longitude.udeg * 0.000001;
+ QGeoCoordinate dsCoord(latitude, longitude);
+ QMetaObject::invokeMethod(m_map, "centerOnCoordinate", Q_ARG(QVariant, QVariant::fromValue(dsCoord)));
}
void MapWidgetHelper::reloadMapLocations()