summaryrefslogtreecommitdiffstats
path: root/map-widget/qmlmapwidgethelper.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-28 22:04:56 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-29 00:09:31 +0000
commitc980216dc0e15a21b245a902870f9b8c5a18275c (patch)
treef30fa3d5267e4b6d8306fb0f2d1bb85b6b2b402d /map-widget/qmlmapwidgethelper.cpp
parent920eb7576ff3c5fab19c12b7b291042817422ac5 (diff)
downloadsubsurface-c980216dc0e15a21b245a902870f9b8c5a18275c.tar.gz
Dive list: take pointer-to-dive_site instead of QVariant
Since "struct dive_site *" is now a Q_METATYPE, the functions MapWidgetHelper::centerOnDiveSite() and ::getCoordinates() can directly get such a pointer instead of a QVariant. This makes the code nicer to read. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'map-widget/qmlmapwidgethelper.cpp')
-rw-r--r--map-widget/qmlmapwidgethelper.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/map-widget/qmlmapwidgethelper.cpp b/map-widget/qmlmapwidgethelper.cpp
index 011433818..a7fb86d9b 100644
--- a/map-widget/qmlmapwidgethelper.cpp
+++ b/map-widget/qmlmapwidgethelper.cpp
@@ -22,21 +22,13 @@ MapWidgetHelper::MapWidgetHelper(QObject *parent) : QObject(parent)
this, SLOT(selectedLocationChanged(MapLocation *)));
}
-QGeoCoordinate MapWidgetHelper::getCoordinates(QVariant dive_site)
+QGeoCoordinate MapWidgetHelper::getCoordinates(struct dive_site *ds)
{
- struct dive_site *ds = (struct dive_site *)dive_site.value<uintptr_t>();
if (!ds || !dive_site_has_gps_location(ds))
return QGeoCoordinate(0.0, 0.0);
return QGeoCoordinate(ds->location.lat.udeg * 0.000001, ds->location.lon.udeg * 0.000001);
}
-void MapWidgetHelper::centerOnDiveSite(QVariant dive_site)
-{
- struct dive_site *ds = (struct dive_site *)dive_site.value<uintptr_t>();
- if (ds)
- centerOnDiveSite(ds);
-}
-
void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds)
{
if (!ds || !dive_site_has_gps_location(ds)) {