mapwidgethelper.cpp: call deselectMapLocation() in QML

If a divesite doesn't have a GPS location we want to deselect
the currently selected markers and zoom out the map. In the Map
QML object the function deselectMapLocation will handle that.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Lubomir I. Ivanov 2017-07-20 01:03:04 +03:00 committed by Dirk Hohndel
parent 250fc1e03f
commit 11eaea01dd

View file

@ -15,8 +15,10 @@ MapWidgetHelper::MapWidgetHelper(QObject *parent) : QObject(parent)
void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds)
{
if (!dive_site_has_gps_location(ds))
if (!dive_site_has_gps_location(ds)) {
QMetaObject::invokeMethod(m_map, "deselectMapLocation");
return;
}
MapLocation *location = m_mapLocationModel->getMapLocationForUuid(ds->uuid);
QMetaObject::invokeMethod(m_map, "centerOnMapLocation", Q_ARG(QVariant, QVariant::fromValue(location)));
}