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:
{
bool doAutoReplot = autoReplot();
setAutoReplot( false );
updateAxes();
/*
Maybe the layout needs to be updated, because of changed
axes labels. We need to process them here before painting
to avoid that scales and canvas get out of sync.
*/
if ( d_data->canvas )
{
d_data->canvas, "replot", Qt::DirectConnection );
if ( !ok )
{
// fallback, when canvas has no a replot method
d_data->canvas->update( d_data->canvas->contentsRect() );
}
}
setAutoReplot( doAutoReplot );
}
void QwtPlot::replot()
{
bool doAutoReplot = autoReplot();
setAutoReplot( false );
updateAxes();
/*
Maybe the layout needs to be updated, because of changed
axes labels. We need to process them here before painting
to avoid that scales and canvas get out of sync.
*/
QApplication::sendPostedEvents( this, QEvent::LayoutRequest );
if ( d_data->canvas )
{
const bool ok = QMetaObject::invokeMethod(
d_data->canvas, "replot", Qt::DirectConnection );
if ( !ok )
{
// fallback, when canvas has no a replot method
d_data->canvas->update( d_data->canvas->contentsRect() );
}
}
setAutoReplot( doAutoReplot );
}
To copy to clipboard, switch view to plain text mode
When I tried, the problems arised when considering the "replot" method of the canvas:
{
invalidateBackingStore();
repaint( contentsRect() );
else
update( contentsRect() );
}
void QwtPlotCanvas::replot()
{
invalidateBackingStore();
if ( testPaintAttribute( QwtPlotCanvas::ImmediatePaint ) )
repaint( contentsRect() );
else
update( contentsRect() );
}
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
Bookmarks