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

TapHandler cannot stop propogating event point

    XMLWordPrintable

Details

    • 36f75c0a1b0145b50f24db397a641c1760cb351a (qt/tqtc-qtdeclarative/5.15)

    Description

      I am not sure if this is a bug or if I am missing something. I am trying to prevent the inner `TapHandler` tap event to propagate to the outer one. From the documentation it sounds like setting `eventPoint.accepted = true` should have done it. However that does not seem to be the case.

      For example, here both rectangles change color instead of just the inner one when you tap (click) the inner one:

      import QtQuick 2.15
      import QtQuick.Controls 2.15Rectangle {
          id: outer
          color: "red"
          anchors.fill: parent
          
          TapHandler { onTapped: outer.color = "green" }    Rectangle {
              id: inner
              
              width: parent.width / 2
              height: parent.height / 2
              color: "blue"
              anchors.centerIn: parent
              
              TapHandler { onTapped: { inner.color = "yellow"; eventPoint.accepted = true } }
          }
      }
      

      (might be related to QTBUG-94012)

      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
            mmi_puya Puya Daravi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes