mapwidget: add the method centerOnIndex()

Again for the port from Marble, later can be removed / renamed.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Lubomir I. Ivanov 2017-07-15 23:34:44 +03:00 committed by Dirk Hohndel
parent 0d3d9c01eb
commit 4334d33413
2 changed files with 11 additions and 0 deletions

View file

@ -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;

View file

@ -22,6 +22,7 @@ public:
public slots:
void centerOnDiveSite(struct dive_site *);
void centerOnIndex(const QModelIndex& idx);
void endGetDiveCoordinates();
private: