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

Strange behavior of onEntered/onExited with nested MouseArea

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.2.1
    • None

    Description

      In the following example, moving the mouse cursor from the outer area to the inner area outputs this :

      exit out
      enter in
      

      I would expect that only "enter in" is printed.

      Furthermore, when clicking inside the inner area, this happens :

      pressed in
      enter out
      pressed out
      

      While "pressed out" is expected, "enter out" is not !

      import QtQuick 2.2
      import QtQuick.Controls 1.1
      
      Rectangle {
          width: 100; height: 100
          color: "red"
      
          MouseArea {
              anchors.fill: parent
              hoverEnabled: true
              onEntered: console.log("enter out")
              onExited: console.log("exit out")
              onClicked: console.log("clicked out")
              onPressed: console.log("pressed out")
          }
      
          Rectangle {
              color: "blue"
              width: 50
              height: 50
              anchors.centerIn: parent
      
              MouseArea {
                  anchors.fill: parent
                  propagateComposedEvents: true
                  hoverEnabled: true
      
                  onEntered: {
                      console.log("enter in")
                  }
                  onExited: {
                      console.log("exit in")
                  }
                  onPositionChanged: {
                      mouse.accepted = false
                  }
                  onClicked: {
                      console.log("clicked in")
                      mouse.accepted = false
                  }
                  onPressed: {
                      console.log("pressed in")
                      mouse.accepted = false
                 }
              }
          }
      }
      

      Attachments

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

        Activity

          People

            kahautam Kari Hautamäki
            mickael9 Mickaël THOMAS
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes