I am trying to get a delegate with a combobox of bmp:s to work in a qtablewidget.

My problem is QVariant. I can get the combobox to work with strings, int, double...but not with a QIcon.

It is not possible to do it this way, since QVariant dont take a QIcon.

Qt Code:
  1. QIcon icon(QPixmap("./icons/check.bmp"));
  2. item1->setIcon(icon);
  3. item1->setData(Qt::EditRole, QVariant(icon));
To copy to clipboard, switch view to plain text mode 

and in the delegates setModelData...

Qt Code:
  1. ComboBox *comboBox = static_cast<ComboBox*>(editor);
  2. int pos = comboBox->currentIndex();
  3.  
  4. QIcon icon = comboBox->itemIcon(pos);
  5. model->setData(index, icon, Qt::EditRole);
To copy to clipboard, switch view to plain text mode 

How can I solve this?