Hi

I'm trying to display an icon in a tableview cell. I've search this forum but only found one thread related to it:
http://www.qtcentre.org/forum/showth...icon+tableview

However this does not help me since that was a tableWidget. I've created a model class inheriting from QAbstractTableModel and in the data() function I'm trying to return a QIcon. I thought this would work since the data function returns a QVariant which should suit a QIcon.

This is the code that is located in my model's data function:
Qt Code:
  1. if (role == Qt::DisplayRole) {
  2. QIcon icon = QIcon(":/images/error.png");
  3. return icon
  4. }
To copy to clipboard, switch view to plain text mode 

Am I missing something? Can I use a .png file? This should be pretty easy to do shouldn't it?

Thanks
Jaco