TableView - interact between itemDelegate and rowDelegate
-
I'm currently using TableView to display a single column so could have well used ListView but since TableView is more desktop friendly (with scroll bars added when necessary and disabling flicks etc) I'm sticking to TableView. I don't know how to communicate between rowDelegate and itemDelegate.
What I'm doing is maintaining arrays, one for each property that I need during interaction. Eg., the height of rowDelegate.
@property var arrayHeights: []
rowDelegate: Rectangle {
height: view.arrayHeights[styledata.row] //assume view is id of TableView which contains property arrayHeights above
}itemDelegate: Text {
id: myText
text: "Random"
Component.onCompleted {
myText.font.pixelSize: Math.floor(Math.random() * 10) + 10
arrayHeights.push(myText.font.pixelSize)
}
}
@
Is there a better way to do it? Else I will need to make such arrays for every property I want to influence in rowDelegate.