Hi to all, I'm developing an audio editor that at the moment has basic functionalities as draw the sound waveform, play the sound.
I would implement a time line ( a moving vertical line ) that give to the user an idea of which part of the sound is playing.
In the paintEvent I have to draw the waveform ( cached in a QImage ) and the time line.

This is my paintEvent
Qt Code:
  1. void WaveWidget::paintEvent( QPaintEvent* pe )
  2. {
  3. // Update the ev->rect area with the wave from the rendered QPixmap here
  4.  
  5. if( m_waveCachePixmap.isNull() )
  6. {
  7. updateWave();
  8. }
  9.  
  10. QPainter p( this );
  11. QPen pen = QPen(Qt::blue, 1);
  12. p.setRenderHint( QPainter::Antialiasing, true );
  13. p.drawImage( 0, 0, m_waveCachePixmap );
  14.  
  15. QRect& rect = QRect(pe->rect());
  16. p.setPen(pen);
  17.  
  18. p.drawLine( rect.x(), 0, rect.x(), height() );
  19. }
To copy to clipboard, switch view to plain text mode 

I also have to delete the previous line before to draw the new? Or the final result is a growing rectangle. How can I do?

Best,
Franco