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

Multiple hovers are incorrect when children are outside parent

XMLWordPrintable

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

      In the following example you can move the mouse from the white, to blue, to orange Rectangles and see the two Rectangles correctly handle hover events (and change color).

      However, if you uncomment the line noted below, and move the mouse directly from white to orange, both blue and orange Rectangles will incorrectly display as hovered. The implementation appears to assume that the inner Rectangle is wholly contained by the outer Rectangle, so both should receive hover.

      import QtQuick 2.0
      
      Item {
          width: 400; height: 400
      
          Rectangle {
              width: 300; height: 300
              anchors.centerIn: parent
              color: ma1.containsMouse ? "green" : "blue"
              MouseArea {
                  id: ma1
                  anchors.fill: parent
                  hoverEnabled: true
      
                  Rectangle {
                      width: 200; height: 200 // + 200 // uncomment to see issue
                      anchors.centerIn: parent
                      color: ma2.containsMouse ? "yellow" : "orange"
                      MouseArea {
                          id: ma2
                          anchors.fill: parent
                          hoverEnabled: true
                      }
                  }
              }
          }
      }
      

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

            srutledg Shawn Rutledge
            mbrasser Michael Brasser
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes