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

Wrong Flickable can get mouse grab when there are 3 or more nested interactive items.

    XMLWordPrintable

Details

    • 71a1288e3d9601d24545ab9650cd079c40766a63

    Description

      If multiple nested Flickables with non zero pressDelays filter another nested items mouse events then the outer Flickable can incorrectly receive mouse grab when the inner Flickable should get it.

      In the example below if you click (press and release) on one of the list items and then move the mouse to the side some distance and attempt to drag the list down it will not move down, instead while the mouse button is held down horizontal movements will drag the outer list view side to side.

      The basic reason is mouse event filtering is done from innermost item out and the inner most Flickable with a pressDelay will accept mouse press events preventing the outer items from filtering them. This means they compare the positions of move events with a previous (replayed) press event and if that's far from the start of the drag the movement appears to have exceeded the drag distance and the mouse is grabbed.

      import QtQuick 2.0
      
      Rectangle {
      
          width: 480
          height: 640
      
          ListView {
              width: 480
              height: 640
              spacing: 5
              orientation: ListView.Horizontal
              pressDelay: 200
              model: [
                  "red",
                  "green",
                  "blue"
              ]
              delegate: ListView {
                  property color rowColor: modelData
                  width:  320
                  height: 640
                  spacing: 5
                  model: 30
                  pressDelay: 200
                  delegate: Rectangle {
                      width: 320
                      height: 30
                      radius: 3
                      color: rowColor
                      
                      MouseArea {
                          anchors.fill: parent
                      }
                  }
              }
          }
      }
      

      Attachments

        For Gerrit Dashboard: QTBUG-37316
        # Subject Branch Project Status CR V

        Activity

          People

            srutledg Shawn Rutledge
            andrew.den.exter Andrew den Exter
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes