Does map in Qt have a property, so it doesn't move center if I move mouse cursor on random place on map and try to change zoom level with mouse wheel? Because on default, map zooms, but moves existing center towards mouse cursor location (example on picture below; if cursor is on shown position and we try to change zoom, geotag picture will move in arrow direction). I just need it to zoom straight up from designated center of map, regardless of mouse cursor location.
Map description: https://doc-snapshots.qt.io/qt5-5.9/qml-qtlocation-map.html
QML code
import QtQuick 2.0
import QtQuick.Window 2.0
import QtLocation 5.6
import QtPositioning 5.6
Item{
id: itemControl
objectName: "itemControl"
width: 512
height: 512
visible: true
Plugin {
id: mapPlugin
PluginParameter { name: "osm.useragent"; value: "usermap" }
name: "esri"
}
Map {
id:map
gesture.enabled: true
gesture.acceptedGestures: MapGestureArea.PinchGesture | MapGestureArea.PanGesture
objectName: "map"
anchors.fill: parent
bearing: 0
width: 512
height: 512
plugin: mapPlugin
center {
latitude: 45.525180446
longitude: 13.5575992170
}
zoomLevel: 15
//If user doubleclicks on map update coordinates of pixel to coordinates on UI
signal qmlSignalUpdateLat(string msg)
signal qmlSignalUpdateLon(string msg)
MouseArea
{
id: mousearea
hoverEnabled: true
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onDoubleClicked: {
map.center.latitude = map.toCoordinate(Qt.point(mouseX,mouseY)).latitude
map.center.longitude = map.toCoordinate(Qt.point(mouseX,mouseY)).longitude
map.qmlSignalUpdateLat(map.center.latitude)
map.qmlSignalUpdateLon(map.center.longitude)
}
}
function updateMap(lat,lon,bear){
map.center.latitude = lat;
map.center.longtitude = lon;
map.bearing = bear;
}
}
}