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

TapHandler reacts to taps even if event is accepted - mouse.accepted is ignored

    XMLWordPrintable

Details

    • Android, iOS/tvOS/watchOS
    • Next, 2023wk02FOQtforAndroid, 2023wk04FOQtforAndroid, 2023wk06FOQtforAndroid, 2023wk10FOQtforAndroid

    Description

      Android 12 seems to ignore the

       

      mouse.accepted = true

       

      and propagates the event further to parent handlers.

       

      I have a simple demo app like this:

       

      Window {
        ...
      
        Item {
          ...
      
          TapHandler {
            ...
            onSingleTapped: {
              if ( drawer.opened ) {
                drawer.close()
              }
              else {
                drawer.open()
              }
            }
          }
        }
      
        Drawer {
          id: drawer
          ...
      
          Rectangle {      
            ...
            MouseArea {        
              ...
              onClicked: (mouse) => {
                mouse.accepted = true
                console.log( "Mouse accepted at drawer" )      
              }
            }
          }
        }
      }

       

      When TapHandler (fills the entire screen) is clicked, the drawer is opened/closed. When the drawer is opened, it reacts to clicks. Those clicks should not be propagated to the beneath TapHandler as I set mouse.accepted = true. However, we found out that the click event on Android 12 is propagated further to the TapHandler, first executing onClicked in MouseArea and then onSingleTapped in the TapHandler. The drawer is thus closed even when a click is inside the drawer.

      If you set `ANDROID_TARGET_SDK_VERSION` to 31, TapHandler receives the event. However, if you set the target SDK to 30, TapHandler will not receive the event.

      Moreover, it does not need to be a drawer, clicks are propagated to the TapHandler through any item...

       

      Note: setting the propagateComposedEvents property to false did not help.

       

      I have attached a simple code that demonstrates it and demo videos as well.

      This is an Android-specific issue, it does not occur on other platforms.

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              tomasmizera Tomas Mizera
              Votes:
              9 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change