Fill the row in QTableView object by condition
-
Hi, I declared a class Table and inherited it from Yatableviev. Then I announced to QSqlTableModel and linked it to my table. Now, I want to paint some of the rows in the table that satisfy the condition in a certain color, but not as Naya. Please help, trying to write as it is written in the forums, but to no avail. Thank you.
-
If I understand correctly, you want to set the background color of some of the rows based on a condition?
Do you have your own model? If so, you could implement the data() method so that for Qt::BackgroundRole you check your data against the condition and return the proper value.
It's somewhat similar to what you see in the first part of the answer here:
http://stackoverflow.com/questions/10219739/set-color-to-a-qtableview-row -
Yes, you currectly understood. Thank you frankiefrank.