mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
8b40490626
commit
a50e9866d5
2 changed files with 9 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue