title: How to change icon using delegate in Qt
body: <p>I am using a delegate in a Qtreeview which just shows an icon next to the text.</p>
  
  <p>What I would like to be able to do is click on one of the items from the list and change the icon of just that one item. I have been looking through some examples but they all use editors which I don't want to do. I want the change to happen automatically on the click action of an item.</p>
  
  <p>I am geussing that I will have to add a new function to my delegate class with the index of the item that i have clicked which is fine, but how do I change the icon ? Do I have to recall the paint function with a new icon to paint ?</p>
  
  <p>This is the delegate that i'm using :</p>
  
  <pre><code>void SeqNavDelegate::paint(QPainter *painter, const QStyleOptionViewItem &amp;option,
         const QModelIndex &amp;index) const
  {
      QStyledItemDelegate::paint(painter, option, index);
  
      if (index.column() == 0 &amp;&amp; option.state &amp; QStyle::State_Enabled)//State_MouseOver)
      {
          const QIcon icon(QLatin1String(":/SeqNavMenu/images/grey.png"));
  
          QRect iconRect(option.rect.right() - option.rect.height(),
                         option.rect.top(),
                         option.rect.height(),
                         option.rect.height());
  
          icon.paint(painter, iconRect, Qt::AlignRight);
      }
  }
  </code></pre>
  
  <p>Do i just reimplement this function with a different icon path ?</p>
  
  <p>Thanks for any help.</p>