Best Practices: Nest elements inside MouseArea or nest MouseArea inside element?
-
As the title says. What are the pros and cons of each way?
-
Hi,
Can you give simple examples of what you want to say ?
-
@
MouseArea
{
width: 400
height: 100
Rectangle
{
anchors.fill: parent
color: "red"
Text
{
text: "btn"
}
}
onClicked:
{
console.log("hi I've been clicked")
}
}
@
vs
@
Rectangle
{
width: 400
height: 100
color: "red"
Text
{
text: "btn"
}
MouseArea
{
anchors.fill: parent
onClicked:
{
console.log("hi I've been clicked")
}
}
}
@