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

When pinching happens in a PinchHandler, an overlapping TapHandler sometimes also triggers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8.2
    • None
    • RAFI Glasscape Touch panel
    • Linux/X11

    Description

      In the following standalone application, if a pinch gesture is performed, starting with one finger on the red Rectangle (which has an associated TapHandler) and the other finger outside of the red rectangle, after you see that scaling actually is happening, when the pinch gesture is then released, the TapHandler sometimes triggers and toggles the rectangle's color. 

      import QtQuick
      import QtQuick.Window
      Window {
          width: 500; height: 500; visible: true
          Rectangle {
              anchors.fill: parent
              color: "#dddddd"
              PinchHandler {
                  property real initScale: 0.0 // to save baseline scale factor of the tappableRect when pinch starts
                  target: null // because we want to handle activeScale changes ourselves
                  grabPermissions: PointerHandler.CanTakeOverFromAnything // when pinch is happening, tap should NOT happen
                  onActiveChanged: {
                      if (active) {
                          initScale = tappableRect.scale;
                      }
                  }
                  onActiveScaleChanged: {
                      if (active) {
                          tappableRect.scale = initScale * activeScale;
                      }
                  }
              }
              Rectangle {
                  id: tappableRect
                  property bool toggled: false
                  width: 100; height: 100; x: 100; y: 100
                  color: toggled ? "green" : "red"
                  TapHandler {
                      // in the hopes that pinching abandons a potential tap
                      grabPermissions: PointerHandler.ApprovesTakeOverByAnything | PointerHandler.ApprovesCancellation
                      onTapped: {
                          tappableRect.toggled = !tappableRect.toggled;
                      }
                  }
              }
          }
      }
      

       

      I can consistently reproduce it, see the attached picture

      1) touch red rectangle with left finger first

      2) add right finger to grey area

      3) move fingers apart until you see scaling happening

      4) release right finger from grey area

      5) release left finger from red rectangle

      Don't perform this sequence too slow, it only reproduces if it's done fast enough!

       

      This will then always toggle the color of the rectangle, proving that the TapHandler also fired even though the PinchHandler has performed its thing.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            chris_w_ Chris Wolkenfelt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes