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

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

XMLWordPrintable

    • Linux/Wayland

      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.

        1. reproducer.zip
          3 kB
          Vlad Zahorodnii
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            zzag Vlad Zahorodnii
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes