I have a scrollview in which I want to place two gridviews with the same delegate, but with different models. However, I want them to "share" the highlighting feature, although I want the models to be highlighted differently. Is this possible? Right now the gridviews overlap inside the scrollview.
ScrollView {
anchors.fill: parent
GridView{
id: grid
anchors.fill: parent
cellHeight: 30
cellWidth: parent.width
model: model1
delegate: delegate
highlight: Rectangle {
color: "red";
radius: 5
focus:true
}
}
GridView {
focus: true
model: model2
delegate: delegate
}
color: model.get(grid.currentIndex).your_field_here === your_condition_here ? "red" : "yellow";
within the highlight component. You can do the same with the delegate, so that you can change the text color, even though from within the delegate you have access to the whole item, so you don't need such a reference to the grid element. – skypjack