Hello, i want to color a whole row using a custom delegate when a specific column contains a date bigger then a set date. What i can actually accomplish is just setting the background color of the cell ...


Atm the code looks like this:

Qt Code:
  1. void Delegate::paint(QPainter *painter,
  2. const QStyleOptionViewItem &option,
  3. const QModelIndex &index) const
  4. {
  5. if ( index.column() == 11 )
  6. {
  7. QDateTime compareDate = QDateTime::fromString("2010-01-01T23:59:59", Qt::ISODate);
  8.  
  9. QVariant date = index.model()->data(index, Qt::DisplayRole);
  10. QDateTime dt = date.toDateTime();
  11. if ( dt > compareDate )
  12. {
  13. if (option.state & QStyle::State_Enabled)
  14. painter->fillRect(option.rect, Qt::green);
  15. QItemDelegate::paint(painter, option, index);
  16. }
  17. }
  18. QItemDelegate::paint(painter, option, index);
  19. }
To copy to clipboard, switch view to plain text mode 

can anybody help with row coloring?