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/modeldelegates.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'desktop-widgets/modeldelegates.cpp') diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp index 7104af33c..f008f4bc2 100644 --- a/desktop-widgets/modeldelegates.cpp +++ b/desktop-widgets/modeldelegates.cpp @@ -453,8 +453,8 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem QString diveSiteName = index.data().toString(); QString bottomText; QIcon icon = index.data(Qt::DecorationRole).value(); - struct dive_site *ds = (struct dive_site *) - index.model()->data(index.model()->index(index.row(), LocationInformationModel::DIVESITE)).value(); + struct dive_site *ds = + index.model()->data(index.model()->index(index.row(), LocationInformationModel::DIVESITE)).value(); struct dive_site *currentDiveSite = current_dive ? get_dive_site_for_dive(current_dive) : nullptr; bool currentDiveSiteHasGPS = currentDiveSite && dive_site_has_gps_location(currentDiveSite); //Special case: do not show name, but instead, show -- cgit v1.2.3-70-g09d2