title: Qt how to create bitmap from data from QVector and show it on widget?
body: <p>I'm wondering how I can create bitmap from my data and show it on my widget. </p>
  
  <p>I have QVector vector, which is vector of some points to draw chart. How I can repaint it on my widget but with using QBitmap? I don't want draw simply on widget, I prefer pass the pixmap to widget, just to show it. </p>
  
  <p>How can I do this?</p>
  
  <p>My code:</p>
  
  <pre><code>QPainter painter(pixMap);
  painter.setPen(QPen(Qt::black, 2));
  painter.drawPolyline(this-&gt;data.data(), this-&gt;data.size());
  painter.drawLine(QPointF(5,5),QPointF(50,50));
  
  setPixmap(*pixMap);
  </code></pre>
  
  <p>Here is my sample code. Why it's not working? I can't see anything on widget.</p>
  
  <p><img src="https://i.stack.imgur.com/L0vdj.png" alt="enter image description here"></p>
  
  <p>I have widget class</p>
  
  <pre><code>class Widget : public QLabel
  {
    public:
      Widget(QVector&lt;QPointF&gt; * data);
      ~Widget();
    protected:
      void paintEvent(QPaintEvent * event);
    private:
      QVector&lt;QPointF&gt; data;
      QPixmap *pixMap;
  };
  </code></pre>
  
  <p>In constructor I have</p>
  
  <pre><code> Widget::Widget(QVector&lt;QPointF&gt; * data){
     pixMap = new QPixmap(300,300);
     pixMap-&gt;fill(Qt::red);
   }
  </code></pre>
  
  <p>And in paintEvent</p>
  
  <pre><code>void Waveform::paintEvent(QPaintEvent *event)
  {
    QPainter painter(pixMap);
    painter.setPen(QPen(Qt::white, 2));
    painter.drawPolyline(this-&gt;data.data(), this-&gt;data.size());
    painter.drawLine(QPointF(5,5),QPointF(50,50));
    setPixmap(*pixMap);
  }
  </code></pre>
  
  <p>If I replace <code>QPainter painter(pixMap)</code> with <code>QPainter painter(this)</code>, I can see my chart. But I want to use pixmap. </p>