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

Child item in negative z receives hover

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.12
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      webOS

      Description

      Here is an example.

      test.qml
      import QtQuick 2.4
      
      Rectangle {
          id: root
          width: 1920
          height: 1080
          color: "yellow"
      
          MouseArea {
              objectName: "red"
              x: 200
              y: 200
              width: 400
              height: 400
              hoverEnabled: true
              onEntered: red.color = "orange"
              onExited: red.color = "red"
      
              Rectangle {
                  id: red
                  objectName: "redRect"
                  anchors.fill: parent
                  color: "red"
              }
      
              MouseArea {
                  objectName: "blue"
                  z: -1
                  x: 100
                  y: 100
                  width: 400
                  height: 400
                  hoverEnabled: true
                  onEntered: blue.color = "steelblue"
                  onExited: blue.color = "blue"
      
                  Rectangle {
                      id: blue
                      objectName: "blueRect"
                      anchors.fill: parent
                      color: "blue"
                  }
      
                  MouseArea {
                      objectName: "white"
                      z: 1
                      x: 100
                      y: 100
                      width: 400
                      height: 400
                      hoverEnabled: true
                      onEntered: white.color = "gray"
                      onExited: white.color = "white"
      
                      Rectangle {
                          id: white
                          objectName: "whiteRect"
                          anchors.fill: parent
                          color: "white"
                      }
                  }
              }
          }
      }
      

      Moving the pointer over "red" rectangle makes all children rectangle "blue" and "white" also hovered, even though they are stacked under.

      If those rectangles are siblings in different z values (red.z = 2, blue.z = 0, white.z = 1 to make the same stacking order), hover events work as expected. See test2.qml below.

      test2.qml
      import QtQuick 2.4
      
      Rectangle {
          id: root
          width: 1920
          height: 1080
          color: "yellow"
      
          MouseArea {
              objectName: "red"
              z: 2
              x: 200
              y: 200
              width: 400
              height: 400
              hoverEnabled: true
              onEntered: red.color = "orange"
              onExited: red.color = "red"
      
              Rectangle {
                  id: red
                  objectName: "redRect"
                  anchors.fill: parent
                  color: "red"
              }
          }
      
          MouseArea {
              objectName: "blue"
              z: 0
              x: 300
              y: 300
              width: 400
              height: 400
              hoverEnabled: true
              onEntered: blue.color = "steelblue"
              onExited: blue.color = "blue"
      
              Rectangle {
                  id: blue
                  objectName: "blueRect"
                  anchors.fill: parent
                  color: "blue"
              }
          }
      
          MouseArea {
              objectName: "white"
              z: 1
              x: 400
              y: 400
              width: 400
              height: 400
              hoverEnabled: true
              onEntered: white.color = "gray"
              onExited: white.color = "white"
      
              Rectangle {
                  id: white
                  objectName: "whiteRect"
                  anchors.fill: parent
                  color: "white"
              }
          }
      }
      

      Note:
      Found in webOS with Qt 5.12 but it is likely reproducible in other platforms and versions because there is no difference in the relevant method QQuickWindowPrivate::deliverHoverEvent between Qt 5.12 and the latest dev branch.

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            jaeyoon.jung Jaeyoon Jung
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There is 1 open Gerrit change