I need to send a Mouse event to a QML object, from QML. For example,
Rectangle
{
id: rect
MouseArea
{
anchors.fill: parent
onClicked: console.log(mouse.x + ', ' + mouse.y)
}
Rectangle
{
x: 0; y: 0; width: 50; height: 50
color: 'red'
onClicked: rect.click(randomX(), randomY()) // <---- HERE
}
}
I’d like the line marked “HERE” to cause a click event for rect which would be passed down to the MouseArea.
There seems to be some relation between your question and this question
Please take a look.