Hello,

I have created QAbstractListModel in the data function I check for the DecorationRole and when that is passed to the function I check for the right column and return a pixmap but I can't get it to work

Qt Code:
  1. ResultModel::data(const QModelIndex& index, int role) const
  2. {
  3. if(!index.isValid())
  4. return QVariant();
  5.  
  6. if(Qt::DisplayRole != role)
  7. return QVariant();
  8.  
  9. ResultItem item = fItems.at(index.row());
  10.  
  11.  
  12. if(Qt::DisplayRole == role)
  13. {
  14. if(kColumnFileName == index.column())
  15. return item.file().fileName();
  16.  
  17. if(kColumnExpectedChecksum == index.column())
  18. return item.expectedChecksum();
  19.  
  20. if(kColumnCalculatedChecksum == index.column())
  21. return item.calculatedChecksum();
  22.  
  23. }
  24.  
  25. // does not work
  26. //
  27. else if(Qt::DecorationRole == role)
  28. {
  29. TRACE("Decoration column: %d\n", index.column());
  30.  
  31. if(kColumnStatus == index.column())
  32. {
  33. int status = item.status();
  34.  
  35. TRACE("Choosing error: %d\n", status);
  36.  
  37. if(ResultItem::kStatusOk == status)
  38. return QPixmap(":/images/ok.png");
  39. }
  40. }
  41.  
  42. return QVariant();
  43. }
To copy to clipboard, switch view to plain text mode 

As you can see I print som trace message when the DecorationRole is suposed to run but I get nothing, it never runs. I know there isn't much info but what can I have done wrong?