I'm trying to set different icon size for top level items of QTreeWidget. I think the way is custom QItemDelegate, but i'm not sure how to do it (delegates are a bit confusing to me). I tryed to subclass "sizeHint()", but it only affects to the item size, not to icon size:

Qt Code:
  1. QSize treeSysDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const {
  2. QSettings skSets(QString("Skin/%1/Skin.ini").arg(CurrSkin), QSettings::IniFormat);
  3.  
  4. if ( index.data(Qt::UserRole).toString() == "TopLevel1") {
  5. return QSize(skSets.value("SystemsTree/HIconSize").toInt(), skSets.value("SystemsTree/HIconSize").toInt());
  6. } else {
  7. return QSize(skSets.value("SystemsTree/IconSize").toInt(), skSets.value("SystemsTree/IconSize").toInt());
  8. }
  9. }
To copy to clipboard, switch view to plain text mode 

How can i apply the sizehint to the icon?


I've noticed that the second arg ofsizeHint() is a QModelIndex, not sure if i must do a cast to QTreeWidget or something....



Hope anybody can help me.
Thanks in advance.