import QtQuick 2.7 import QtQuick.Window 2.0 import QtPositioning 5.7 import QtLocation 5.9 Window { id: appWin visible: true width: 1000 height: 800 title: qsTr("Hello World") Plugin { id: mapPlugin name: "osm" } Map { id: map_ anchors.fill: parent plugin: mapPlugin center: QtPositioning.coordinate(59.91, 10.75) // Oslo zoomLevel: 14 MapRectangle { id: blueRect_ topLeft: QtPositioning.coordinate(59.91, 10.75) bottomRight: QtPositioning.coordinate(topLeft.latitude - 0.01, topLeft.longitude + 0.01) color: "blue" MouseArea { anchors.fill: parent drag.target: parent } onXChanged: { console.log( "blue", x, y, width, height, topLeft, bottomRight ) } onYChanged: { console.log( "blue", x, y, width, height, topLeft, bottomRight ) } } MapRectangle { id: redRect_ topLeft: QtPositioning.coordinate(59.91, 10.75) bottomRight: QtPositioning.coordinate(topLeft.latitude + 0.01, topLeft.longitude + 0.01) color: "red" MouseArea { anchors.fill: parent drag.target: parent } onXChanged: { console.log( "red", x, y, width, height, topLeft, bottomRight ) } onYChanged: { console.log( "red", x, y, width, height, topLeft, bottomRight ) } } } }