Call a function by onClicked in qml
-
I am trying to call a function clearcanvas by "onClicked" event of the button.
Can anybody help me out on this so that when I click on the button it should call the function and execute it.!http://instacod.es/file/75943(My code look like)!
-
1 : Declare the function clear outside of the Canvas component
2 : Declare the var ctx as a property of canvas
3: please post your codes by text rather than image next time, this would easier for us to help you@
QtObject{
id: paramfunction clearCanvas(ctx){
ctx.clearRect(....)
}
}Canvas{
id:canvasproperty var ctx
}
//.....
Rectangle{
//.....
MouseArea:{
anchors.fill:parentonClicked:{
clearCanvas(canvas.ctx)
}
}
}
@ -
Thank you for suggestion.