Hi to all,
I would put in a separate thread a method of my class that actually blocks the gui.
The method is responsible of drawing an audio waveform into a QWidget in the paint event

So:
Qt Code:
  1. void WaveDisplay::paintEvent( QPaintEvent* pe )
  2. {
  3. // Update the ev->rect area with the wave from the rendered QPixmap here
  4. if( m_waveCachePixmap.isNull() )
  5. {
  6. updateWave();// BLOCK MY GUI
  7. }
  8.  
  9. QPainter p( this );
  10. p.setRenderHint( QPainter::Antialiasing, true );
  11. QPen pen = QPen( Qt::darkRed, 1 );
  12.  
  13. // wave
  14. p.drawPixmap( 0, 0, m_waveCachePixmap );
  15.  
  16. QWidget::paintEvent(pe);
  17. }
To copy to clipboard, switch view to plain text mode 

AND

Qt Code:
  1. // THIS ROUTINE BLOCK MY GUI
  2. void WaveDisplay::updateWave()
  3. {
  4. int h = this->height();
  5. int w = this->width();
  6.  
  7. // I want another width and height here.
  8. // Also, you might to clear the cache at resize events
  9. QPixmap temp = QPixmap( w, h );
  10.  
  11. QPainter p( &temp );
  12. //p.setRenderHint( QPainter::Antialiasing, true );
  13. p.fillRect( temp.rect(), bgColor );
  14.  
  15. ...more code to draw the wave...
  16. }
To copy to clipboard, switch view to plain text mode 

I read about threads and QtConcurrent but I don't know how to adapt my code even because I have to pass the painter
and paint on a specific widget.

I hope to get help.

Regards