I have two function update() and fun().
I have a MouseArea in a Rectangle, when I trigger update() on onEntered it is working, but when I use fun() for same on onEntered it is throwing the following error:
ReferenceError: fun is not defined
Here is my code:
import QtQuick 2.12
import QtQuick.Window 2.12
Window {
width: 640
height: 480
Rectangle {
width: 100
height: 100
color: "orange"
function update() {
console.log(x + " x " + y)
idText.text = Math.round(x) + " x " + Math.round(y)
}
function fun() {
console.log("check is called")
}
Text {
id: idText
text: qsTr("text")
anchors.centerIn: parent
}
Component.onCompleted: update()
onXChanged: update()
MouseArea {
anchors.fill: parent
drag.target: parent
onEntered: fun()
//onEntered: update()
}
}
}
Rectangle{ id: rectangle // ...and then userectangle.fun()- eyllanesc