Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.11.2, 5.13.0
-
None
-
8f1857f907153c4a98c73d572ea76c2b7ca33b5d (qt/qtdeclarative/5.14)
Description
When a MouseArea is made visible, containsMouse is set to true if the mouse pointer is inside the MouseArea, even if the MouseArea is not enabled.
Test with the following reproduction code in qmlscene.
A Rectangle with a disabled MouseArea filling it is shown/hidden every 3000ms. If the mouse is inside the Rectangle when it is made visible, then mouseArea.containsMouse is true. I would expect that containsMouse is false in this case.
containsMouse does not change to false when moving the mouse out of the Rectangle in this state.
If the mouse is outside of the Rectangle when it is shown, then containsMouse will not change to true when moving the mouse over the Rectangle (which is as expected).
The problem also occurs if enabled: false is moved from the MouseArea to the Rectangle.
import QtQuick 2.4 import QtQuick.Controls 1.3 import QtQuick.Window 2.11 Window { id: root width: 500 height: 500 Rectangle { id: rect width: 400 height: 400 anchors.centerIn: parent color: mouseArea.containsMouse ? "red" : "green" MouseArea { id: mouseArea anchors.fill: parent enabled: false hoverEnabled: true } } Timer { id: rectShowHideTimer interval: 3000 repeat: true running: true onTriggered: rect.visible = !rect.visible } }
Tested with both 5.11.2 and 5.13.0 on Ubuntu 18.04.