mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-29 21:50:26 +00:00
a50e9866d5
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>
25 lines
708 B
C++
25 lines
708 B
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#include <QDebug>
|
|
|
|
#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)
|
|
{
|
|
if (!dive_site_has_gps_location(ds))
|
|
return;
|
|
|
|
qreal longitude = ds->longitude.udeg / 1000000.0;
|
|
qreal latitude = ds->latitude.udeg / 1000000.0;
|
|
|
|
QMetaObject::invokeMethod(m_map, "centerOnCoordinates",
|
|
Q_ARG(QVariant, latitude),
|
|
Q_ARG(QVariant, longitude));
|
|
}
|