@while1code That's the problem ,i cannot pass canvas ID outside ie.,in onCurrentIndexChanged function.
Now I achieved the same using signal and slots by adding following code :
Canvas {
id: canvas1
anchors.fill: parent
width: parent.width
height: parent.height
onPaint: {
styleData.selected ? drawTab(canvas1,"#0C3142") :
drawTab(canvas1,"Transparent")
}
//*** CONNECT TO SIGNAL HERE ***
Connections
{
target: tv
onRefresh: canvas1.requestPaint()
}
...
...
...
onCurrentIndexChanged: {
console.log("index changed "+currentIndex)
refresh() //emiting refresh signal
}