diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-07-19 03:06:40 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-28 07:31:11 -0700 |
commit | b4740803a1b71d27146df0b13460c222cf2e2ca8 (patch) | |
tree | f2b6aa955e549ffbb9380f99c38c883dad8b3d9c /mobile-widgets | |
parent | 4a126b553f218b0a695b3709f099ac81fa53b1d8 (diff) | |
download | subsurface-b4740803a1b71d27146df0b13460c222cf2e2ca8.tar.gz |
mapwidgethelper: pass a MapLocation object to QML in centerOnDiveSite()
The function in QML centerOnCoordinate() is now renamed
centerOnMapLocation() and accepts a MapLocation object, so that
a marker is selected (based on UUID).
In MapWidgetHelper::centerOnDiveSite(), the pointer to a MapLocation
is retrieved via MapLocationModel::getMapLocationForUuid(). Added in the
previous commit.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qml/MapWidget.qml | 5 | ||||
-rw-r--r-- | mobile-widgets/qmlmapwidgethelper.cpp | 7 |
2 files changed, 5 insertions, 7 deletions
diff --git a/mobile-widgets/qml/MapWidget.qml b/mobile-widgets/qml/MapWidget.qml index 7249ed632..ddfd2938c 100644 --- a/mobile-widgets/qml/MapWidget.qml +++ b/mobile-widgets/qml/MapWidget.qml @@ -70,10 +70,11 @@ Item { } } - function centerOnCoordinate(coordinate) { - map.newCenter = coordinate; + function centerOnMapLocation(mapLocation) { + map.newCenter = mapLocation.coordinate; map.zoomLevel = 2; mapAnimation.restart(); + mapHelper.model.selectedUuid = mapLocation.uuid; } } } diff --git a/mobile-widgets/qmlmapwidgethelper.cpp b/mobile-widgets/qmlmapwidgethelper.cpp index 801e46620..e0781e7c7 100644 --- a/mobile-widgets/qmlmapwidgethelper.cpp +++ b/mobile-widgets/qmlmapwidgethelper.cpp @@ -17,11 +17,8 @@ void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds) {
if (!dive_site_has_gps_location(ds))
return;
-
- qreal longitude = ds->longitude.udeg / 1000000.0;
- qreal latitude = ds->latitude.udeg / 1000000.0;
- QVariant coord = QVariant::fromValue(QGeoCoordinate(latitude, longitude));
- QMetaObject::invokeMethod(m_map, "centerOnCoordinate", Q_ARG(QVariant, coord));
+ MapLocation *location = m_mapLocationModel->getMapLocationForUuid(ds->uuid);
+ QMetaObject::invokeMethod(m_map, "centerOnMapLocation", Q_ARG(QVariant, QVariant::fromValue(location)));
}
void MapWidgetHelper::reloadMapLocations()
|