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

Unexpected MouseArea behavior when scale is 0

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.2
    • Fix Version/s: None
    • Labels:
      None

      Description

      In QML when some MouseArea gets scaled to 0 (due to some animation on parent visual item) it seems the MouseArea is moved to (0; 0) at full scale.

      Consider the simple example listed below. There's a red rectangle with a mouse area at (0;0) and a blue rect with a mousearea somewhere else. A click on the background will toggle the scale of the blue rect. When the scale of the blue rect is 0, the signal handler of the blue rect is executed when I click the red rectangle.

       

      Window {
       width: 640
       height: 480
       visible: true
       title: qsTr("Hello World")
      
      MouseArea {
       anchors.fill: parent
       onClicked: blueRect.scale = (blueRect.scale === 1) ? 0 : 1
       }
      
      Rectangle {
       width: 100
       height: 100
       color: "red"
      
      MouseArea {
       anchors.fill: parent
       onClicked: console.log("Red rect clicked")
       }
       }
      
      Rectangle {
       id: blueRect
       x: 200
       y: 200
       width: 100
       height: 100
       color: "blue"
      
      MouseArea {
       anchors.fill: parent
       onClicked: console.log("Blue rect clicked")
       }
       }
      }
      

       

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            davykox Davy Kox
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes