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

Problems with grabbing / logic control in overlapped Tap and Drag Handlers.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.13.0
    • None
    • Dell XPS 15 9560, Windows 10
    • Windows

    Description

      Example code:

      import QtQuick 2.13
      import QtQuick.Controls 2.13
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
      
          Repeater {
              model: 2
      
              Rectangle {
                  y: index === 1 ? 30 : 0
                  width: 200
                  height: 60
                  color: tapHandler.pressed ? "yellow" : (dragHandler.active ? "red" : "grey")
                  opacity: 0.7
      
                  Label {
                      text: "%1".arg(index)
                      font.pixelSize: 30
                  }
      
                  TapHandler {
                      id: tapHandler
      
                      //grabPermissions: PointerHandler.ApprovesTakeOverByHandlersOfDifferentType
                      onTapped: {
                          console.debug("onTapped:", index)
                          //eventPoint.accepted = true;
                      }
                  }
                  DragHandler {
                      id: dragHandler
                  }
              }
          }
      }
      

      Steps to reproduce of the problem:

      1. Tap in the place where both rectangles overlap
      2. Signal onTapped will be emitted for both TapHandlers

      I tried to find a solution without using any workarounds (e.g. modal layer under each of the rectangles), but unfortunately without success. Regardless of the grabPolicy used or attempts to accept the event in onTapped, tapped signal will be emitted for both TapHandlers.

      I know that TapHandler with gesturePolicy: TapHandler.DragThreshold takes no excusives grab, but it would be useful to have some possibility to control the logic in the example above. We want to share grab with DragHandler and not with another TapHandler in this case.

      Attachments

        Issue Links

          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
              permotion88 Karol Polak
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes