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

TapHandler steals events with gesturePolicy WithinBounds

    XMLWordPrintable

Details

    • iOS/tvOS/watchOS

    Description

      The following example tries to nail down the problem, while the original code is a bit more complex. The original code is in turn the reason why I need to set the gesturePolicy to TapHandler.WithinBounds.

      There are two button like objects that overlap for some reason (the original has a flickable and an overlaying button). The problem is, that clicking the overlay button also triggers the element below (on the first click after the mouse has been moved).

      import QtQuick
      import QtQuick.Controls.Material
       
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Rectangle {
              id: superButton
              width: label.width + 20
              height: normalButton.height
              color: "green"
      
              Text {
                  id: label
                  text: "Superbutton with click magnetic super power"
                  color: "white"
                  anchors.centerIn: parent
              }
      
              TapHandler {
                  onTapped: () => console.log("'green' tapped")
                  grabPermissions: PointerHandler.TakeOverForbidden
                  gesturePolicy: TapHandler.WithinBounds
              }
          }
      
          Button {
              id: normalButton
              text: "Tap me!"
              onClicked: () => console.log("'normal' tapped")
          }    
      }

      The expected behaviour is, that only the on top element receives the event in the given configuration.

      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
              cajus Cajus Pollmeier
              Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes