在Qt Android中点击地图时如何获取坐标

在Qt Android中点击地图时如何获取坐标,android,qml,maps,touch-event,mousearea,Android,Qml,Maps,Touch Event,Mousearea,我正在使用Qt5.14.1。当我在屏幕上点击时,我会在屏幕上点击两下后得到地图坐标。第一次和第二次点击未获得Coorchinates值。两次三次点击后,在第一个或第二个坐标附近绘制下一个坐标图,与点击位置无关。我正在使用以下代码 Map { id: mapOfWorld anchors.centerIn: parent; anchors.fill: parent activeMapType: supportedMap

我正在使用Qt5.14.1。当我在屏幕上点击时,我会在屏幕上点击两下后得到地图坐标。第一次和第二次点击未获得Coorchinates值。两次三次点击后,在第一个或第二个坐标附近绘制下一个坐标图,与点击位置无关。我正在使用以下代码

        Map {
        id: mapOfWorld
        anchors.centerIn: parent;
        anchors.fill: parent
        activeMapType: supportedMapTypes[1];
        gesture.enabled: true
        gesture.acceptedGestures: MapGestureArea.PanGesture
        plugin: hereMaps

        MouseArea {
        id: mapAreaClick
        focus: true
        anchors.rightMargin: 470
        transformOrigin: Item.Center
        anchors.horizontalCenterOffset: -1
        anchors.fill: mapOfWorld
        anchors.centerIn: mapOfWorld
        propagateComposedEvents : true
        preventStealing : true
        hoverEnabled: true
        drag.axis: Drag.XandYAxis
        drag.target: mapOfWorld
        onReleased: {
               console.log("MouseArea onReleased")
        }
         onPositionChanged: {
             mapOfWorld.pan(lastX-mouse.x, lastY-mouse.y)
            lastX = mouse.x
            lastY = mouse.y
         }

        // move or drag map        
        onPressAndHold: {
            mapAreaClick.enabled = false
            mapOfWorld.center = mapOfWorld.toCoordinate((Qt.point((mouse.x),(mouse.y))))
            console.log("MouseArea onPressAndHold")
        }
        // plot the waypoint
        onPressed:  {
            mapOfWorld.focus = true
            mapAreaClick.enabled = true
             var cordinate = mapOfWorld.toCoordinate((Qt.point((mouse.x),(mouse.y))));
             Geofence.addGeoFenceAsset(cordinate)
             }
             }

         }