From a920d683a196ff28be3e8fa9bbaaab2a67b05553 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Wed, 19 Jul 2017 02:50:07 +0300 Subject: mapwidgethelper: add a slot to handle marker selection from the model When MapLocationModel updates the selected marker, MapWidgetHelper now receives a signal. The slot is named selectedLocationChanged(). Signed-off-by: Lubomir I. Ivanov --- mobile-widgets/qmlmapwidgethelper.cpp | 7 +++++++ mobile-widgets/qmlmapwidgethelper.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/mobile-widgets/qmlmapwidgethelper.cpp b/mobile-widgets/qmlmapwidgethelper.cpp index 264b62abb..801e46620 100644 --- a/mobile-widgets/qmlmapwidgethelper.cpp +++ b/mobile-widgets/qmlmapwidgethelper.cpp @@ -9,6 +9,8 @@ MapWidgetHelper::MapWidgetHelper(QObject *parent) : QObject(parent) { m_mapLocationModel = new MapLocationModel(this); + connect(m_mapLocationModel, SIGNAL(selectedLocationChanged(MapLocation *)), + this, SLOT(selectedLocationChanged(MapLocation *))); } void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds) @@ -38,3 +40,8 @@ void MapWidgetHelper::reloadMapLocations() } m_mapLocationModel->addList(locationList); } + +void MapWidgetHelper::selectedLocationChanged(MapLocation *location) +{ + qDebug() << location; +} diff --git a/mobile-widgets/qmlmapwidgethelper.h b/mobile-widgets/qmlmapwidgethelper.h index bd575c624..83f9df140 100644 --- a/mobile-widgets/qmlmapwidgethelper.h +++ b/mobile-widgets/qmlmapwidgethelper.h @@ -5,6 +5,7 @@ #include class MapLocationModel; +class MapLocation; struct dive_site; class MapWidgetHelper : public QObject { @@ -23,6 +24,9 @@ private: QObject *m_map; MapLocationModel *m_mapLocationModel; +private slots: + void selectedLocationChanged(MapLocation *); + signals: void modelChanged(); }; -- cgit v1.2.3-70-g09d2