Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.9.7, 5.11.3, 5.12.3, 5.13.0 Beta3
-
None
-
-
56fbc277a1acc49d9ead4c89edd250a021ef2a01 (qt/qtdeclarative/5.12)
Description
When quickly panning a Map or Flickable which contains a MouseArea then the "onClicked" and "onDoubleClicked" events are triggered. I think the "onClicked" event is intended, but the "onDoubleClicked" event should not be triggered.
This video demonstrates the problem on a Map: https://youtu.be/1wuzbf_gTB8
Steps to reproduce:
- Quickly pan the map (really fast but many users do it this way).
- The events are triggered.
import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.3 import QtLocation 5.9 import QtPositioning 5.8 ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Hello World") Map { id: map anchors.fill: parent plugin: Plugin { name: "osm" } MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton onDoubleClicked: { console.log("Double clicked") var mouseGeoPos = map.toCoordinate(Qt.point(mouse.x, mouse.y)); var preZoomPoint = map.fromCoordinate(mouseGeoPos, false); if (mouse.button === Qt.LeftButton) { map.zoomLevel = Math.floor(map.zoomLevel)+1; } else if (mouse.button === Qt.RightButton) { map.zoomLevel = Math.floor(map.zoomLevel)-1; } var postZoomPoint = map.fromCoordinate(mouseGeoPos, false); var dx = postZoomPoint.x - preZoomPoint.x; var dy = postZoomPoint.y - preZoomPoint.y; var mapCenterPoint = Qt.point(map.width / 2.0 + dx, map.height / 2.0 + dy); map.center = map.toCoordinate(mapCenterPoint); } onClicked: { console.log("Clicked") } onPressAndHold: { console.log("Press and hold") } } } }