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

TapHandler blocks flicking

    XMLWordPrintable

Details

    • Android, iOS/tvOS/watchOS

    Description

      The TapHandler seems to block flicking when you start the scrolling gesture close to the edge of the TapHandlers parent.

      Start the example below on a touch-device (seems to be reproducible on adroid and ios) and start scrolling down fast inside one of the rectangles close to the bottom edge. In that case the flicking does not start although the TapHandler is canceled.

      You might have to try it several times to hit the right spot to see the problem.

      import QtQuick 2.15
      import QtQuick.Controls 2.15
      
      ApplicationWindow {
          id: window
          visible: true
          width: 640
          height: 480
      
      
          Flickable {
              x: 20
              y: 40
              width: parent.width
              height: parent.height
              contentWidth: width
              contentHeight: grid.height
              onMovingChanged: console.log("moving")
      
              Grid {
                  id: grid
                  columns: 4
                  spacing: 8
                  Repeater {
                      id: rep
                      model: 100
                      delegate: Loader {
                          sourceComponent: d
                      }
                  }
              }
          }
      
          Component {
              id: d
              Item {
                  
                  width: 180
                  height: 180
                  
                  
                  Rectangle {
                      id: r
                      color: {
                          if (dh.active) return "green"
                          if (dh.enabled) return "gold"
                          
                          return "yellow"
                      }
                      anchors.fill: parent
                      border.width: 1
                      radius: 18
                      
                      Drag.active: dh.active
                      z: dh.active ? 999 : 0
                      
                      Item {
                          anchors.fill: parent
                          TapHandler {
                              onLongPressed: {
                                  r.Drag.hotSpot = point.position
                                  dh.enabled = true
                              }
                              
                              onSingleTapped: {
                                  console.log('tap')
                              }
                              grabPermissions: PointerHandler.ApprovesTakeOverByAnything
                              onGrabChanged: console.log(transition, point)
                              onCanceled: console.log('canceled')
                              onPressedChanged: console.log("pressed;", pressed)
                              onActiveChanged: console.log("active", active)
                          }
                          
                      }
                      
                      DragHandler{
                          id: dh
                          enabled: false
                          onActiveChanged: {
                              if (!active) {
                                  r.Drag.drop()
                                  r.x = 0
                                  r.y = 0
                              }
                              enabled = active
                          }
                      }
                  }
              }
          }
      }
      
      

      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
              tobiasb Tobias Bräutigam
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes