diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-03-08 21:38:14 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-03-11 11:40:12 -0700 |
commit | 8fa2295a6174a0cc0cd86a0aea0420eb453bdd63 (patch) | |
tree | ee04f20bec3ada9449135a41549fc3765e9a7c64 /map-widget/qmlmapwidgethelper.cpp | |
parent | eb8772d967cc033c7d0e38d3b659eb869be61ac4 (diff) | |
download | subsurface-8fa2295a6174a0cc0cd86a0aea0420eb453bdd63.tar.gz |
qmapwidgethelper: add centerOnDiveSiteUUID()
centerOnDiveSiteUUID() is a helper to center the map on a dive_site
UUID instead of a dive_site pointer.
Make it call centerOnDiveSite().
Make both this function and reloadMapLocations() Q_INVOKABLE
as these are going to be called from QML.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'map-widget/qmlmapwidgethelper.cpp')
-rw-r--r-- | map-widget/qmlmapwidgethelper.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/map-widget/qmlmapwidgethelper.cpp b/map-widget/qmlmapwidgethelper.cpp index 26590269a..6046d08cc 100644 --- a/map-widget/qmlmapwidgethelper.cpp +++ b/map-widget/qmlmapwidgethelper.cpp @@ -23,6 +23,14 @@ MapWidgetHelper::MapWidgetHelper(QObject *parent) : QObject(parent) this, SLOT(selectedLocationChanged(MapLocation *))); } +void MapWidgetHelper::centerOnDiveSiteUUID(QVariant dive_site_uuid) +{ + const uint32_t uuid = qvariant_cast<uint32_t>(dive_site_uuid); + struct dive_site *ds = get_dive_site_by_uuid(uuid); + if (ds) + centerOnDiveSite(ds); +} + void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds) { int idx; |