{
//QDateTime::fromString(dateString, Qt::ISODate);
//compareDate = compareDate.addYears(30);
//qDebug("Date is: %s", qPrintable(compareDate.toString()));
QModelIndex testindex
= index.
model()->index
(index.
row(),
11, index.
parent());
// get index of "watched" column if( index.model()->data(testindex, Qt::DisplayRole).toDateTime() > compareDate)
{
painter->fillRect(option.rect, Qt::green);
}
}
void Delegate::paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
QDateTime compareDate = QDateTime::currentDateTime();
//QDateTime::fromString(dateString, Qt::ISODate);
//compareDate = compareDate.addYears(30);
//qDebug("Date is: %s", qPrintable(compareDate.toString()));
QModelIndex testindex = index.model()->index(index.row(), 11, index.parent()); // get index of "watched" column
if( index.model()->data(testindex, Qt::DisplayRole).toDateTime() > compareDate)
{
painter->fillRect(option.rect, Qt::green);
}
QItemDelegate::paint( painter, option, index );
}
To copy to clipboard, switch view to plain text mode
Bookmarks