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

TapHandler: Similar property as MouseAreas propagateComposedEvents

    XMLWordPrintable

Details

    Description

      User has requested TapHandlers to have similar property as MouseAreas propagateComposedEvents.

      Example where overlapping Rectangles with Taphandlers will both have click events but the MouseAreas will not with propagateComposedEvents: false:

      import QtQuick.Window 2.12
      import QtQuick 2.14
      
      Window {
          visible: true
          width: 640
          height: 480
          Rectangle {
              anchors.fill : parent
              color: '#1e1e1e'
      
              Rectangle {
                  width : 120
                  height : width
                  color : "green"
                  TapHandler {
                      onTapped: console.log( "GREEN" );
                  }
              }
              Rectangle {
                  //anchors.centerIn: parent
                  width : 80
                  height : width
                  color : "red"
                  TapHandler {
                      onTapped: console.log( "RED" );
                      grabPermissions: PointerHandler.TakeOverForbidden
                  }
              }
          }
          Rectangle {
              y:200
              color: "yellow"
              width: 100; height: 100
      
              MouseArea {
                  anchors.fill: parent
                  onClicked: console.log("clicked yellow")
              }
      
              Rectangle {
                  color: "blue"
                  width: 50; height: 50
      
                  MouseArea {
                      anchors.fill: parent
                      propagateComposedEvents: false
                      onClicked: {
                          console.log("clicked blue")
                          mouse.accepted = false
                      }
                  }
              }
          }
      
      }
      

       

      Attachments

        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
            tero.pelkonen Tero Pelkonen
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes