Setting Map.center from javascript
Unsolved
QML and Qt Quick
-
I am having a problem setting Map.center from javascript Qt5.7. The code below is a variant on minimal_map for mapbox.
The console log gives.
qml: map.center.latitude -0
qml: map.center.longitude 1.34624
So the latitude value seems to get set to zero when setting coordinates. I have tried numerous approaches to trying to set map.ceter but cannot get any of them to work.It might be related to the following bug report https://bugreports.qt.io/browse/QTBUG-55424
So what I want to know. If it's the same bug what is the work around? If it's not a bug what obvious thing am I overlooking?
Window {
width: 512
height: 512
visible: truePlugin { id: mpaboxPlugin name: "mapbox" PluginParameter { name: "mapbox.access_token" value: myAccessToken } PluginParameter { name: "mapbox.map_id" value: "examples.map-zr0njcqy" } } Map { id: map anchors.fill: parent plugin: mpaboxPlugin center { latitude: 29 longitude: 15 } zoomLevel: 6 } PositionSource { id: positionSource onPositionChanged: { //map.center = QtPositioning.coordinate(59.91, 10.75); map.center.latitude = 52.0; map.center.longitude = 1.346240; console.log("map.center.latitude", map.center.latitude); console.log("map.center.longitude", map.center.longitude); } }
}