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

DragHandler propagates tap event through Flickable to underlying TapHandler

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.2.4, 6.5.3, 6.7.2, 6.8.0 Beta3
    • None
    • a6e196ce9 (dev), ae7069bfa (6.5), dd3484343 (6.5.0), b0bb5823e (6.4), a8fb5c36c (tqtc/lts-6.2)

    Description

      DragHandler propagates tap event through Flickable/ListView to underlying TapHandler.

      Code example:

      import QtQuick
      import QtQuick.Layouts
      
      Window {
          id: window
          width: 640
          height: 480
          visible: true
      
          Rectangle {
              id: mainRect
              anchors.fill: parent
              TapHandler {
                  onTapped: {
                      mainRect.color = Qt.rgba(Math.random(), Math.random(), Math.random(), 1)
                      console.log("Tapped")
                  }
              }
          }
      
          Flickable {
              id: flickable
              anchors {
                  fill: parent
                  leftMargin: 50
                  rightMargin: 50
              }
              contentWidth: content.implicitWidth
              contentHeight: content.implicitHeight
      
              ColumnLayout {
                  id: content
                  width: flickable.width
                  Rectangle {
                      Layout.fillWidth: true
                      height: window.height / 2 + 100
                      border.width: 1
                      color: 'red'
                      DragHandler {
                          onActiveChanged: console.log("Drag active: " + active)
                      }
                  }
      
                  Rectangle {
                      Layout.fillWidth: true
                      height: window.height / 2 + 100
                      border.width: 1
                      color: 'blue'
                  }
              }
          }
      }
      

      Steps to reproduce:
      click on "red" rectangle (flickable's child with DragHandler inside)

      Actual results:
      tap event is propagated to underlying rectangle (id: mainRect), see console output

      Expected result:
      tap event is NOT propagated to underlying rectangle (id: mainRect), i.e. the behavior should be
      the same as for "blue" rectangle (flickable's child without DragHandler inside)

      Note:
      in the example above, if we drop Flickable from there, the behavior for "red" and "blue" rectangle
      will be identical. both will propagate tap event to underlying rectangle with TapHandler.

      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
              studiosus Vladimir Belyavsky
              Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: