welcome to forum. Did you create the instance of second qml component inside the first qml ? You need create instance, assign the id and through id you need to call.
Try this.
=== TestFunction.qml====
Rectangle {
width: 100
height: 100
function callme(val, val){
console.log("I am called man="+val + " ok="+val)
}
}
====== main.qml========
Rectangle {
width: 640
height: 480
TestFunction{
id : func
}
Button {
text: qsTr("Hello World")
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
onClicked: {
func.callme("pthinks.com","Bangaluru")
}
}
}
↧