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

Mouse position events can't be passed through nested MouseArea

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Won't Do
    • Affects Version/s: 5.2.1
    • Fix Version/s: None
    • Labels:
      None

      Description

      With overlapping MouseArea, it seems to be impossible to pass mouse position events from an inner MouseArea to an outer one.

      In this example, I would expect that the outer rectangle's coordinates change when mouse is moved inside the inner rectangle.

      import QtQuick 2.2
      import QtQuick.Controls 1.1
      
      Rectangle {
          color: "red"
          width: 100
          height: 100
          
          MouseArea {
              id: outer
              anchors.fill: parent
              hoverEnabled: true
          }
      
          Label { text: outer.mouseX + "," + outer.mouseY }
      
          Rectangle {
              color: "blue"
              width: 50
              height: 50
              anchors.centerIn: parent
              
              MouseArea {
                  id: inner
                  anchors.fill: parent
                  hoverEnabled: true
      
                  onPositionChanged: {
                      mouse.accepted = false // documentation says this is ignored, why is that?
                  }
              }
      
              Label { text: inner.mouseX + "," + inner.mouseY }
          }
      }
      

      This is most likely related to QTBUG-37544

        Attachments

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

          Activity

            People

            Assignee:
            srutledg Shawn Rutledge
            Reporter:
            mickael9 Mickaƫl THOMAS
            Votes:
            23 Vote for this issue
            Watchers:
            22 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes