title: How to write paintEvent() for Subclassed QComboBox
body: <p>I SubClassed QComboBox in order to customize it. I wrote the following paintEvent() method to test to see that my style sheet was being applied properly before I started with the customization. However, if I use this paintEvent, the selected item is not being displayed(the already selected one -or- the one I newly select). </p>
  
  <pre><code>class MyComboBox: public QComboBox
  {
      Q_OBJECT
  public:
      MyComboBox(QWidget *parent = 0): QComboBox(parent){}
  
      virtual void paintEvent(QPaintEvent* pEvent)
      {
      QStylePainter painter(this);
      QStyleOptionComboBox opt;
      initStyleOption(&amp;opt);
      painter.drawComplexControl(QStyle::CC_ComboBox, opt);
      QVariant itemData = this-&gt;itemData( this-&gt;currentIndex(), Qt::DisplayRole);
      if(!itemData.isNull() &amp;&amp; qVariantCanConvert&lt;QPen&gt;(itemData))
          style()-&gt;drawItemText(&amp;painter,this-&gt;rect(),Qt::AlignLeft,(this-&gt;palette()), true, itemData.toString());
      }
  };
  </code></pre>
  
  <p>How do I fix the paintEvent? Also, is there documentation on the paintEvent for different Qt Controls?</p>