void Plot::timerEvent( QTimerEvent * ) { CircularBuffer *buffer = static_cast<CircularBuffer *>( d_curve->data() ); buffer->setReferenceTime( d_clock.elapsed() / 1000.0 ); if ( d_settings.updateType == Settings::RepaintCanvas ) { // the axes in this example doesn't change. So all we need to do // is to repaint the canvas. QMetaObject::invokeMethod( canvas(), "replot", Qt::DirectConnection ); } else { replot(); } }
void Plot::timerEvent( QTimerEvent * ) { CircularBuffer *buffer = ( CircularBuffer * )d_curve->data(); buffer->setReferenceTime( d_clock.elapsed() / 1000.0 ); switch( d_settings.updateType ) { case Settings::RepaintCanvas: { // the axes in this example doesn't change. So all we need to do // is to repaint the canvas. canvas()->replot(); break; } default: { replot(); } } }