【发布时间】:2015-10-18 09:36:53
【问题描述】:
这是我的 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同时生效呢?
【问题讨论】: