so i am trying to get an icon to fill up the space of a QTableWidgetItem. so i subclassed the ItemDelegate and set it to my QTableWidget, but still, the icons wont fill out the item in the table.

here is my code... below is what i have at the top of my *.cpp file

Qt Code:
  1. class MyItemDelegate: public QItemDelegate
  2. {
  3. public:
  4. MyItemDelegate(QObject* pParent = 0) : QItemDelegate(pParent)
  5. {
  6. std::cout<<"INSIDE DELEGATE PAINT~~~~~~~~~~~~~~~~~~"<<std::endl;
  7. }
  8. void MyItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
  9. {
  10. QIcon icon = qvariant_cast<QIcon>(index.data(Qt::DecorationRole));
  11. drawBackground(painter, option, index);
  12. drawDecoration(painter, option, option.rect, icon.pixmap(option.rect.size()));
  13. drawFocus(painter, option, option.rect);
  14. std::cout<<"INSIDE DELEGATE PAINT"<<std::endl;
  15. }
  16. };
To copy to clipboard, switch view to plain text mode 

and here is where i am setting the delegate to my table

Qt Code:
  1. mThumbArea->setItemDelegate(new MyItemDelegate(mThumbArea));
To copy to clipboard, switch view to plain text mode 

here is where i add the icon to the table

Qt Code:
  1. QTableWidgetItem *newItemImage = new QTableWidgetItem(QIcon(filename),"");
  2. mThumbArea->setItem(0,0,newItemImage);
To copy to clipboard, switch view to plain text mode 

filename is valid, and the item is successfully added to the table, its just that the icon is much too small... what is happening!!!