QStandardItem *item = new QStandardItem(str);
item->setSizeHint(QSize(25,25));
QVariant typeVal(type);
item->setData(typeVal,Qt:
ecorationPropertyRole);
m_LogModel->appendRow(item);
Q_ASSERT(index.isValid());
QString text = index.data(Qt:
isplayRole).toString();
if(!text.isEmpty())
{
painter->save();
QRect cellRect = option.rect;
QBrush brush;
int m_nMsgType = index.data(Qt:
ecorationPropertyRole).toInt();
qDebug() << "DelegateItem Type : " << m_nMsgType;
if(m_nMsgType == LOGTYPE_NORMAL){
painter->setPen(QColor(0,255,0));
}
else{
painter->setPen(QColor(255,0,0));
}
painter->drawText(cellRect, Qt::AlignLeft, text);
painter->restore();
}