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

Gesture events originated in graphicsview should not be delivered outside of the graphicsview

    XMLWordPrintable

Details

    Description

      Improve the gesture event delivery inside graphicsview.

      Currently gesture recognizers act as event filters - there is a gesture recognizer state attached to all widgets and graphicsitems that subscribe to a gesture, and events that are delivered to those widgets/items are filtered through the recognizer first and if the recognizer 'triggers', a gesture event is delivered to a widget/item.

      The way it works right now for graphicsitems: before delivering an event to a graphicsitem, filter it through the gesture recognizer, then deliver the generated gesture event using the hotspot of the gesture - first it gets delivered to the viewport, which forwards it to the graphics scene, which detect which items the gesture event should go to.

      That additional step of delivering gesture events to viewport is unnecessary and introduces problems when you gesture recognizer can trigger on both widget-based and graphicsview-based events. For example imaging you have a Tap gesture recognizer which triggers on both QEvent::MouseButtonPress and QEvent::GraphicsSceneMousePress. When the user clicks inside the graphicsview, first the QEvent::MouseButtonPress will be delivered to the viewport (which is also subscribed to Tap gesture) - this triggers the gesture and the appropriate gesture event is delivered to the viewport, which forwards it to the scene and then to graphicsitems. However the original MouseButtonPress event was not consumed so the viewport converts the event into a graphicsscene event and send QEvent::GraphicsSceneMousePress to the scene and items. However the item is subscribed to gestures, so the graphicsscene mouse event is filtered through the gesture recognizer and Tap gesture is triggered again - and then it is sent to the viewport -> scene -> items...

      All that results in gesture event triggering twice and being delivered twice to the item in graphicsview.

      Attachments

        Issue Links

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              dzyubenk Denis Dzyubenko (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: