Dear All:

New to Qt - and have created a Tableview from a SqlQuery Model. Problem is - If the Validity Column is > 1 I want
the entire row to be red...
I tried something like this but nothing happened...

Qt Code:
  1. void Edit_Log_Dialog::chk_Valid_Log_Line()
  2. {
  3. QModelIndex chk_line;
  4. QColor rowColor = Qt::red;
  5. int validity;
  6. for (int row = 1; row < current_Log_View->model()->rowCount(); row++)
  7. {
  8. chk_line = current_Log_View->model()->index(row,7);
  9. validity = rfa_Log_Model->data(chk_line, Qt::DisplayRole).toInt();
  10. if (validity > 1)
  11. {
  12. for (int i = 1; i< 8; i++)
  13. {
  14. chk_line = current_Log_View->model()->index(row,i);
  15. rfa_Log_Model->setData(chk_line,rowColor,Qt::ForegroundRole);
  16. }
  17. }
  18. }
  19. }
To copy to clipboard, switch view to plain text mode 

I saw something about using QItemDelegate - but wondered if there was an easier way to do this, or do I have to create a subclass
or something - which I am a bit fuzzy about.

Thanks, Tb