So, when a user clicks on a row, the colour of that row should change. This is what I have tried. It doesn't work.
Here table
is the id of my QML TableView
.
Let default color be blue and on click it should change to red.
rowDelegate:
Rectangle
{
id: rowDel
color:
{
var activeRow = table.currentRow === styleData.row;
(activeRow ? mouse_area.pressed ? "red" : "blue" : "white")
}
border.width: 1
height: 52
width: 2000
MouseArea
{
id: mouse_area
anchors.fill: parent
}
}
onClicked
handler to your MouseArea, does it get called? (Put a print statement inside.) – JarMan