mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 11:43:23 +00:00
mapwidgethelper: pass a QGeoCoordinate to the QML map
Rename the QML function "centerOnCoordinates" to "centerOnCoordinate" and pass a QGeoCoordinate to it in ::centerOnDiveSite(). This will prevent the creation of a QGeoCoordinate object on the QML side and instead it will be created in C++. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
de90480b46
commit
476670cb8d
2 changed files with 4 additions and 6 deletions
|
@ -60,8 +60,8 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function centerOnCoordinates(latitude, longitude) {
|
function centerOnCoordinate(coordinate) {
|
||||||
map.newCenter = QtPositioning.coordinate(latitude, longitude);
|
map.newCenter = coordinate;
|
||||||
map.zoomLevel = 2;
|
map.zoomLevel = 2;
|
||||||
mapAnimation.restart();
|
mapAnimation.restart();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,8 @@ void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds)
|
||||||
|
|
||||||
qreal longitude = ds->longitude.udeg / 1000000.0;
|
qreal longitude = ds->longitude.udeg / 1000000.0;
|
||||||
qreal latitude = ds->latitude.udeg / 1000000.0;
|
qreal latitude = ds->latitude.udeg / 1000000.0;
|
||||||
|
QVariant coord = QVariant::fromValue(QGeoCoordinate(latitude, longitude));
|
||||||
QMetaObject::invokeMethod(m_map, "centerOnCoordinates",
|
QMetaObject::invokeMethod(m_map, "centerOnCoordinate", Q_ARG(QVariant, coord));
|
||||||
Q_ARG(QVariant, latitude),
|
|
||||||
Q_ARG(QVariant, longitude));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWidgetHelper::reloadMapLocations()
|
void MapWidgetHelper::reloadMapLocations()
|
||||||
|
|
Loading…
Add table
Reference in a new issue