Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-75731

Map+MouseArea dragging stops working with multiple fingers

    XMLWordPrintable

    Details

    • Platform/s:
      All

      Description

      Steps to reproduce:

      1. Press and hold the map with two (or more) finger for 1-2 seconds (until the long press signal is emitted).
      2. Try to drag/move the map -> fails.
      3. Pinch&Zoom.
      4. Drag/moving the map works again.

       

      Bringing the app to back- and foreground again does not bring back the drag/move functionality. The only means to get it back is a multi-finger gesture such as pinch&zoom or multi-finger dragging.

       

      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: {
                      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")
                  }
      	}
          }
      }
      
      

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            srutledg Shawn Rutledge
            Reporter:
            DanielSt Peter Staab
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes