title: QPixmap on QLabel doesn't show correctly
body: <p>I am trying to draw some shape with <code>QPainter</code> class and save it to disk. As far as I know the easiest way is to use <code>QPainter</code> to draw into a <code>QPixmap</code>, visualize in the pixmap though a <code>QLabel</code>, and use <code>QPixmap::save</code>.</p>
  <p>But when I run this test I see only a little black box inside the QWidget.</p>
  <pre><code>MyWidget::MyWidget()
  {
      std::cout &lt;&lt; &quot;MyWidget &gt; .&quot; &lt;&lt; std::endl;
  
      l = new QLabel();
      l-&gt;setParent(this);
      pixmap = new QPixmap(460, 480);
      painter = new QPainter(pixmap);
  }
  
  MyWidget::~MyWidget()
  {
      delete pixmap;
      delete painter;
  }
  
  void MyWidget::paintEvent(QPaintEvent *event)
  {
      std::cout &lt;&lt; &quot;dudee&quot; &lt;&lt; std::endl;
  
      painter-&gt;begin(pixmap);
  
      painter-&gt;drawLine(1,1,100,100);
      QPen myPen(Qt::black, 2, Qt::SolidLine);
      painter-&gt;setPen(myPen);
      painter-&gt;drawLine(100,100,100,1);
      painter-&gt;setRenderHint(QPainter::Antialiasing, true);
      painter-&gt;setPen(QPen(Qt::black, 3, Qt::DashDotLine, Qt::RoundCap));
      painter-&gt;setBrush(QBrush(Qt::green, Qt::SolidPattern));
      painter-&gt;drawEllipse(200, 80, 400, 240);
  
      painter-&gt;end();
  
      l-&gt;setPixmap(*pixmap);
  }
  </code></pre>
  <p>I have tried to add some l-&gt;update() but it doesn't change anything..</p>
  <h1>EDIT:</h1>
  <p>It should be an animation. I get the animation work through a QTimer that call every n msec the function for draw (not the paintEvent as the answer suggest)</p>