Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.0.2
-
None
Description
The issue can be reproduced with the following snippet:
import QtQuick 2.0 Item { id: wrapper width: 400; height: 400 MouseArea { id: mouseArea anchors.fill: parent onPressed: console.log("pressed") onReleased: console.log("released") onCanceled: console.log("canceled") } // simulate outside event Timer { interval: 2000 running: true onTriggered: { console.log("triggered") mouseArea.enabled = false //wrapper.enabled = false } } }
To reproduce:
- Start the example
- Press the mouse
- Wait for the timer to fire
- Release the mouse
When using mouseArea.enabled = false the following output occurs:
pressed
triggered
released
When using wrapper.enabled = false the following output occurs instead:
pressed
triggered
canceled
In my case, the wrapper behavior is what I was wanting from the MouseArea. This basic issue is also noted in QTBUG-29783. As mentioned there, the current MouseArea behavior was changed to fix a bug, however, I don't believe the difference in behavior between MouseArea and other Items was intentional.
If this behavior cannot be changed, it would be nice to have the difference documented.
Attachments
Issue Links
- relates to
-
QTBUG-38364 MouseArea doesn't propagate the disabled state to children
-
- Open
-
-
QTBUG-29783 onPositionChanged signal keeps coming when MouseArea enabled is set to false in onPressed.
-
- Closed
-