From 920eb7576ff3c5fab19c12b7b291042817422ac5 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 28 Oct 2018 21:16:42 +0100 Subject: Dive site: pass pointer-to-dive_site via QVariant There was this ugly pattern of passing pointers-to-dive_site via a QVariant of void * type. This is of course inherently unsafe. Pass these pointers using their proper types instead. This makes it necessary to register them in Qt's meta-type system. Doing so, fixes a bug: QML couldn't call into updateDiveSiteCoordinates() because it didn't know the type and thus the coordinates of the moved flag were not reflected in the divesite-dialog. Signed-off-by: Berthold Stoeger --- desktop-widgets/mapwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'desktop-widgets/mapwidget.cpp') diff --git a/desktop-widgets/mapwidget.cpp b/desktop-widgets/mapwidget.cpp index 9d3735efb..ac90c577d 100644 --- a/desktop-widgets/mapwidget.cpp +++ b/desktop-widgets/mapwidget.cpp @@ -67,7 +67,7 @@ void MapWidget::centerOnDiveSite(struct dive_site *ds) void MapWidget::centerOnIndex(const QModelIndex& idx) { CHECK_IS_READY_RETURN_VOID(); - struct dive_site *ds = (struct dive_site *)idx.model()->index(idx.row(), LocationInformationModel::DIVESITE).data().value(); + dive_site *ds = idx.model()->index(idx.row(), LocationInformationModel::DIVESITE).data().value(); if (!ds || ds == RECENTLY_ADDED_DIVESITE || !dive_site_has_gps_location(ds)) centerOnSelectedDiveSite(); else -- cgit v1.2.3-70-g09d2