title: How to paint correct text color in QStyledItemDelegate
body: <p>I'd like to draw a custom item delegate, which follows the current style. But there are differences between "WindowsVista/7" style and "WindowsClassic" for text color.</p>
  
  <p><img src="https://i.stack.imgur.com/Ylh6K.png" alt="difference between winViste/7 and winClassic"></p>
  
  <p>Im using the following code for drawing the background (working):</p>
  
  <pre><code>void FriendItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem&amp; option, const QModelIndex&amp; index) const
  {
      painter-&gt;save();
  
      QStyleOptionViewItem opt = option;
      initStyleOption(&amp;opt, index);
      QStyle *style = opt.widget ? opt.widget-&gt;style() : QApplication::style();
      QSize hint = sizeHint(opt, index);
  
      style-&gt;drawPrimitive(QStyle::PE_PanelItemViewItem, &amp;opt, painter, opt.widget);
      ...
  }
  </code></pre>
  
  <p>How to draw the text in correct color?</p>
  
  <p>I can't use <code>style-&gt;drawControl(QStyle::CE_ItemViewItem, &amp;opt, painter, opt.widget);</code> to draw the whole item, because I have to draw more special text than one text line. (This function would paint the colors correctly.)</p>
  
  <p>I tried with <code>style-&gt;drawItemText(painter, opt.rect, opt.displayAlignment, opt.palette, true, "Hello World!");</code> but it paints always black. And for <code>painter-&gt;drawText()</code>, I have no idea how to set the correct pen color.</p>