diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-07-17 18:02:37 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-28 07:31:11 -0700 |
commit | a50e9866d5f42d76338a4cc9a51f54272dea65bc (patch) | |
tree | 86778e37ecf979a838ce7f638d8b6a1706a70fa6 /mobile-widgets | |
parent | 8b40490626e1cf52243e67c2ff76d55ccff8bf58 (diff) | |
download | subsurface-a50e9866d5f42d76338a4cc9a51f54272dea65bc.tar.gz |
qmlmapwidgethelper: maintain an instance of MapLocationModel
The idea here is that the QML code should be able to fetch a model
from the MapWidgetHelper instance which is instantiated inside the
QML code; fetch it in the lines of "mapHelper.model".
This way, updates at the backend would be reflected on the Map QML widget.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qmlmapwidgethelper.cpp | 4 | ||||
-rw-r--r-- | mobile-widgets/qmlmapwidgethelper.h | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/mobile-widgets/qmlmapwidgethelper.cpp b/mobile-widgets/qmlmapwidgethelper.cpp index e56d670d3..3a0e4aa71 100644 --- a/mobile-widgets/qmlmapwidgethelper.cpp +++ b/mobile-widgets/qmlmapwidgethelper.cpp @@ -1,12 +1,14 @@ // SPDX-License-Identifier: GPL-2.0
#include <QDebug>
-#include "qmlmapwidgethelper.h"
+#include "qmlmapwidgethelper.h"
#include "core/dive.h"
#include "core/divesite.h"
+#include "qt-models/maplocationmodel.h"
MapWidgetHelper::MapWidgetHelper(QObject *parent) : QObject(parent)
{
+ m_mapLocationModel = new MapLocationModel(this);
}
void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds)
diff --git a/mobile-widgets/qmlmapwidgethelper.h b/mobile-widgets/qmlmapwidgethelper.h index 9fd427856..d0f450ed6 100644 --- a/mobile-widgets/qmlmapwidgethelper.h +++ b/mobile-widgets/qmlmapwidgethelper.h @@ -4,12 +4,14 @@ #include <QObject>
+class MapLocationModel;
struct dive_site;
class MapWidgetHelper : public QObject {
Q_OBJECT
Q_PROPERTY(QObject *map MEMBER m_map)
+ Q_PROPERTY(MapLocationModel *model MEMBER m_mapLocationModel NOTIFY modelChanged)
public:
explicit MapWidgetHelper(QObject *parent = NULL);
@@ -18,6 +20,10 @@ public: private:
QObject *m_map;
+ MapLocationModel *m_mapLocationModel;
+
+signals:
+ void modelChanged();
};
#endif
|