1 Attachment(s)
Change color of only the first row in QML/Qt TableView
I am using TableView of QtQuick.Controls 1.4
This is the rowDelegate. I want to have just the first row of blue colour and rest of the rows (empty or non-empty) of green color.
Code:
rowDelegate:
Rectangle
{
border.width: 1
height: 50
width: 2000
color: {
var item = mymodel.get( styleData.row )
if (item.index1 === "1")
return "blue"
return "green"
}
}
Now, my problem is that this code does colour the first row as blue but it also colours the empty rows as blue.
What is the way to solve this problem?
Attachment 13582
Re: Change color of only the first row in QML/Qt TableView
Hi, probably item.index1 is not what you expect it to be. Use a debugger to check the value for the other rows.
Ginsengelf