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

Document role of onCanceled in PinchArea/Flickable and MouseArea interaction



    • Commits:


      Following is a use case faced by a customer who was using the QML Map Element. The customer wanted to use both a MouseArea and PinchArea on the same Map item (please see attached example).

      The MouseArea was for handling panning, while the PinchArea was meant to handle zooming.

      Apparently when there was a MouseArea and a PinchArea together, the following steps occur:

      0) MouseArea gets a MousePressed event (and, in this case, was subsequently preparing to pan the map) (this step was unexpected)

      1) PinchArea gets a PinchStarted event (and prepares to zoom)
      2) PinchArea gets a few PinchUpdated events (and does it's magic)
      3) PinchArea gets a PinchFinished event (and wraps the zoom up)

      That SHOULD have been all that was needed... but.. the following was happening too...

      4) MouseArea would then, it appears, never get a closing event, thus leaving the pan area not knowing that a pan is not about to take place.
      5) On the next mouse touch, the MouseArea's panning code (still initialized from before) would see an update and try to pan the map immediately, thus throwing things way off.

      Lines 46 and 55 make sure that the initialization done in the MouseArea is canceled if, in fact, a Gesture is occurring instead of a plain mouse event.

      We need to either improve the Qt Documentation to explain this better or make this the default behavior whenever PinchArea and MouseArea overlap.


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



            srutledg Shawn Rutledge
            rajivr Rajiv M Ranganath
            3 Vote for this issue
            6 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes