Hello!

Is there a way for doing a partial replot using a reimplemented QwtPlot::replot()? This partial replot would be essentially to tell which area of the graph I want to be reploted instead of the entire canvas.

I noticed the code for QwtPlot::replot() in 6.1.0 is:

Qt Code:
  1. void QwtPlot::replot()
  2. {
  3. bool doAutoReplot = autoReplot();
  4. setAutoReplot( false );
  5.  
  6. updateAxes();
  7.  
  8. /*
  9.   Maybe the layout needs to be updated, because of changed
  10.   axes labels. We need to process them here before painting
  11.   to avoid that scales and canvas get out of sync.
  12.   */
  13. QApplication::sendPostedEvents( this, QEvent::LayoutRequest );
  14.  
  15. if ( d_data->canvas )
  16. {
  17. const bool ok = QMetaObject::invokeMethod(
  18. d_data->canvas, "replot", Qt::DirectConnection );
  19. if ( !ok )
  20. {
  21. // fallback, when canvas has no a replot method
  22. d_data->canvas->update( d_data->canvas->contentsRect() );
  23. }
  24. }
  25.  
  26. setAutoReplot( doAutoReplot );
  27. }
To copy to clipboard, switch view to plain text mode 

When I tried, the problems arised when considering the "replot" method of the canvas:

Qt Code:
  1. void QwtPlotCanvas::replot()
  2. {
  3. invalidateBackingStore();
  4.  
  5. if ( testPaintAttribute( QwtPlotCanvas::ImmediatePaint ) )
  6. repaint( contentsRect() );
  7. else
  8. update( contentsRect() );
  9. }
To copy to clipboard, switch view to plain text mode 

If I understood correctly, I'll have to create a new QwtPlotCanvas for my custom QwtPlot with a reimplemented replot() method in which instead of using contentsRect(), I'll use a QRect with customized form previously set by a new method.

Is this all ok or did I miss something?


Thanks,

Momergil