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

If there are two sibling MouseAreas, QEvent::isAccepted() won't be properly set

    XMLWordPrintable

Details

    • Linux/Wayland

    Description

      If there are two sibling mouse areas stacked on top of each other and they both accept left mouse button press events, after forwarding the QMouseEvent to QQuickWindow, QEvent::isAccepted() will not return true.

       

      import QtQuick
      
      Rectangle {
          color: "red"
      
          MouseArea {
              anchors.fill: parent
              onPressed: (mouse) => {
                  console.log("mouse area 1");
              }
          }
      
          MouseArea {
              anchors.fill: parent
              onPressed: (mouse) => {
                  console.log("mouse area 2");
                  mouse.accepted = true;
              }
          }
      }
      

       

      The attached demo shows the issue. It forwards a fake mouse button press event to the quick view and even though the second mouse area accepts the press event, event.isAccepted() returns false, which is unexpected.

      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
            zzag Vlad Zahorodnii
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes