title: How to remove/clear previously drawn lines before redrawing new lines in Qt?
body: <p>I am drawing few lines using <code>paintEvent(QPaintEvent * event)</code>. Sometime later if I want to draw new lines then the previously drawn lines are not cleared/removed. How could I draw the new lines only, by removing/clearing old lines. Is there any property to clear the previously drawn lines.Please let me know.</p>
  
  <pre><code>void QGraphWidget::paintEvent(QPaintEvent * event)
  {
      const QRect &amp; rect = event-&gt;rect();
      QPainter painter(this);
      painter.setRenderHint(QPainter::Antialiasing);
      drawLines(painter, rect);//calling painter.drawLine() inside
  }
  </code></pre>
  
  <p>Thanks...</p>