这是我的 QML 代码:
Rectangle
{
.....
Rectangle
{
....height and width is smaller than parent
MouseArea
{
id: mouseArea2
anchors.fill: parent
hoverEnabled: true
onEntered:
{
console.log("enter 2")
}
}
}
MouseArea
{
id: mouseArea1
anchors.fill: parent
hoverEnabled: true
onEntered:
{
console.log("enter 1")
}
}
}
才mouseArea1生效。如果我删除mouseArea1则mouseArea2生效。所以我认为鼠标事件必须由mouseArea1它处理并且不能传递给mouseArea2.
我搜索文档以找出哪些 attr 可以防止这种行为,但没有找到。那么如何让mouseArea1和同时mouseArea2生效呢?