summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mapwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/mapwidget.cpp')
-rw-r--r--desktop-widgets/mapwidget.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/desktop-widgets/mapwidget.cpp b/desktop-widgets/mapwidget.cpp
index 8753e1d98..c083c5f73 100644
--- a/desktop-widgets/mapwidget.cpp
+++ b/desktop-widgets/mapwidget.cpp
@@ -1,6 +1,7 @@
#include <QQmlContext>
#include <QDebug>
#include <QQuickItem>
+#include <QModelIndex>
#include "mapwidget.h"
#include "core/dive.h"
@@ -27,6 +28,15 @@ void MapWidget::centerOnDiveSite(struct dive_site *ds)
qDebug() << longitude << latitude;
}
+void MapWidget::centerOnIndex(const QModelIndex& idx)
+{
+ struct dive_site *ds = get_dive_site_by_uuid(idx.model()->index(idx.row(), 0).data().toInt());
+ if (!ds || !dive_site_has_gps_location(ds))
+ centerOnDiveSite(&displayed_dive_site);
+ else
+ centerOnDiveSite(ds);
+}
+
void MapWidget::reload()
{
// TODO;