I have a QML map created that when zooming via scroll, zooms to the center of the map as opposed to zooming to the cursor location. From another SO answer, I came to the conclusion that this should be a default behavior, but it is not working that way for me.
import QtQuick 2.5
import QtQuick.Window 2.0
import QtQuick.Controls 1.4
import QtLocation 5.5
import QtPositioning 5.5
ApplicationWindow {
title: "Mapper"
id: mapWindow
x: Screen.width / 2 - width / 2
y: Screen.height / 2 - height / 2
width: 1400
height: 800
visible: true
color: "#0b2f5c"
Map
{
id: basemap
objectName: "basemap"
property string inputStr: "import QtQuick 2.0; import QtLocation 5.0; import QtPositioning 5.0; "
anchors.fill: parent
anchors.rightMargin: 300
anchors.leftMargin: 25
anchors.topMargin: 50
anchors.bottomMargin: 50
plugin: Plugin
{
name: "osm"
PluginParameter
{
name: "osm.mapping.custom.host"
value: "https://a.tile.openstreetmap.org/"
}
}
activeMapType: supportedMapTypes[supportedMapTypes.length - 1]
center: QtPositioning.coordinate(0, 0)
zoomLevel: 2
minimumZoomLevel: 2
}
}
I am launching the window with QQmlApplicationEngine
in C++
QQmlApplicationEngine* engine = new QQmlApplicationEngine(QUrl("<path to file>"));
QObject* topLevel = mEngine->rootObjects().value(0);
QQuickWindow* window = qobject_cast<QQuickWindow*>(mTopLevel);
window->show();
What is going on here? Thanks in advance!