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

Disabled MouseArea stealing hover events

    XMLWordPrintable

Details

    • bbcc2657fa0dbf715e6db7d675662e4be94a1e04 (qt/qtdeclarative/dev) 3f14cae462c890e22aa1948e1dec60d297dd0b23 (qt/qtdeclarative/6.2)

    Description

      When a disabled MouseArea overlaps another (active) one, the disabled item prevents the visible one to get hover events, and additionally creates a bug because on click the visible item will get a mouse enter and no mouse exit. So it will stay hovered forever.

      Documentation states :

      The enabled property is used to enable and disable mouse handling for the proxied item. When disabled, the mouse area becomes transparent to mouse events

      So it seems like a bug that a disable MouseArea is stealing events anyway.

      Here is the minimal code to reproduce :

      import QtQuick 2.1;
      import QtQuick.Window 2.1;
      
      Window {
          id: window;
          width: 800;
          height: 600;
          visible: true;
      
          MouseArea {
              width: 400;
              height: 300;
              hoverEnabled: true;
              anchors.centerIn: parent;
      
              Text  {
                  text: parent.containsMouse;
                  font.pixelSize: 42;
                  anchors.centerIn: parent;
              }
              Rectangle {
                  color: "yellow";
                  border.color: "black";
                  border.width: (parent.containsMouse ? 2 : 0);
                  anchors.fill: parent;
              }
          }
          MouseArea {
              enable: false; // replace with visible:false to workaround bug
              hoverEnabled: true;
              anchors.fill: parent;
          }
      }
      

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              srutledg Shawn Rutledge
              thebootroo Thomas Boutroue
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes