Hello, I finally could solve the problem

I reimplemented the Plot class and now, it is no longer a class derived from QwtPlot.

Now I will show you the files in case in the future someone is presented with the same doubt as me:

Plot.h
Qt Code:
  1. class Plot
  2. {
  3.  
  4. public:
  5. Plot(QwtPlot * = NULL );
  6. ~Plot();
  7.  
  8. void replot();
  9.  
  10. void updateCurve();
  11.  
  12. void setXinterval( double min, double max );
  13.  
  14. void setYinterval( double min, double max );
  15.  
  16. void setPen(const QColor &color, qreal width=0.0, Qt::PenStyle style = Qt::SolidLine);
  17.  
  18.  
  19. private:
  20.  
  21.  
  22. QwtPlot *plot;
  23.  
  24. QwtPlotCurve *d_curve;
  25. int d_paintedPoints;
  26.  
  27. QwtPlotDirectPainter *d_directPainter;
  28.  
  29. QwtInterval x_interval;
  30. QwtInterval y_interval;
  31.  
  32. };
To copy to clipboard, switch view to plain text mode 

Plot.cpp
Qt Code:
  1. #include "plot.h"
  2. #include "curvedata.h"
  3. #include "signaldata.h"
  4. #include <qwt_plot_canvas.h>
  5. #include <qwt_plot_marker.h>
  6. #include <qwt_plot_curve.h>
  7. #include <qwt_plot_directpainter.h>
  8. #include <qwt_curve_fitter.h>
  9. #include <qwt_painter.h>
  10.  
  11. class Canvas: public QwtPlotCanvas
  12. {
  13. public:
  14. Canvas( QwtPlot *plot = NULL ):
  15. QwtPlotCanvas( plot )
  16. {
  17. // The backing store is important, when working with widget
  18. // overlays ( f.e rubberbands for zooming ).
  19. // Here we don't have them and the internal
  20. // backing store of QWidget is good enough.
  21.  
  22. setPaintAttribute( QwtPlotCanvas::BackingStore, false );
  23. setBorderRadius( 10 );
  24.  
  25. if ( QwtPainter::isX11GraphicsSystem() )
  26. {
  27. #if QT_VERSION < 0x050000
  28. // Even if not liked by the Qt development, Qt::WA_PaintOutsidePaintEvent
  29. // works on X11. This has a nice effect on the performance.
  30.  
  31. setAttribute( Qt::WA_PaintOutsidePaintEvent, true );
  32. #endif
  33.  
  34. // Disabling the backing store of Qt improves the performance
  35. // for the direct painter even more, but the canvas becomes
  36. // a native window of the window system, receiving paint events
  37. // for resize and expose operations. Those might be expensive
  38. // when there are many points and the backing store of
  39. // the canvas is disabled. So in this application
  40. // we better don't disable both backing stores.
  41.  
  42. if ( testPaintAttribute( QwtPlotCanvas::BackingStore ) )
  43. {
  44. setAttribute( Qt::WA_PaintOnScreen, true );
  45. setAttribute( Qt::WA_NoSystemBackground, true );
  46. }
  47. }
  48.  
  49. }
  50.  
  51. };
  52.  
  53. Plot::Plot( QwtPlot *parent ):
  54. plot( parent ),
  55. d_paintedPoints( 0 ),
  56. x_interval( 0.0, 100000.0 ),
  57. y_interval( 0.0, 2000.0 )
  58. {
  59. d_directPainter = new QwtPlotDirectPainter();
  60.  
  61. plot->setAutoReplot( false );
  62. plot->setCanvas( new Canvas() );
  63.  
  64. plot->setAxisScale( QwtPlot::xBottom, x_interval.minValue(), x_interval.maxValue() );
  65. plot->setAxisScale( QwtPlot::yLeft, y_interval.minValue(), y_interval.maxValue() );
  66.  
  67. d_curve = new QwtPlotCurve();
  68. d_curve->setStyle( QwtPlotCurve::Lines );
  69. // d_curve->setPen( plot->canvas()->palette().color( QPalette::WindowText ) );
  70. d_curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
  71. d_curve->setPaintAttribute( QwtPlotCurve::ClipPolygons, false );
  72. d_curve->setData( new CurveData() );
  73. d_curve->attach( plot );
  74. }
  75.  
  76. Plot::~Plot()
  77. {
  78. delete d_directPainter;
  79. }
  80.  
  81.  
  82.  
  83. void Plot::replot()
  84. {
  85. CurveData *data = static_cast<CurveData *>( d_curve->data() );
  86. data->values().lock();
  87.  
  88. plot->replot();
  89. d_paintedPoints = data->size();
  90.  
  91. data->values().unlock();
  92. }
  93.  
  94. void Plot::setXinterval( double min, double max )
  95. {
  96. x_interval.setMaxValue( max );
  97. x_interval.setMinValue( min );
  98. plot->setAxisScale( QwtPlot::xBottom,
  99. x_interval.minValue(), x_interval.maxValue() );
  100.  
  101. replot();
  102. }
  103.  
  104. void Plot::setYinterval( double min, double max )
  105. {
  106. y_interval.setMaxValue( max );
  107. y_interval.setMinValue( min );
  108. plot->setAxisScale( QwtPlot::yLeft,
  109. y_interval.minValue(), y_interval.maxValue() );
  110.  
  111. replot();
  112. }
  113.  
  114. void Plot::setPen(const QColor &color, qreal width, Qt::PenStyle style)
  115. {
  116. d_curve->setPen(color, width, style);
  117. }
  118.  
  119. void Plot::updateCurve()
  120. {
  121. CurveData *data = static_cast<CurveData *>( d_curve->data() );
  122. data->values().lock();
  123.  
  124. const int numPoints = data->size();
  125. if ( numPoints > d_paintedPoints )
  126. {
  127. const bool doClip = !plot->canvas()->testAttribute( Qt::WA_PaintOnScreen );
  128. if ( doClip )
  129. {
  130. /*
  131.   Depending on the platform setting a clip might be an important
  132.   performance issue. F.e. for Qt Embedded this reduces the
  133.   part of the backing store that has to be copied out - maybe
  134.   to an unaccelerated frame buffer device.
  135.   */
  136.  
  137. const QwtScaleMap xMap = plot->canvasMap( d_curve->xAxis() );
  138. const QwtScaleMap yMap = plot->canvasMap( d_curve->yAxis() );
  139.  
  140. QRectF br = qwtBoundingRect( *data,
  141. d_paintedPoints - 1, numPoints - 1 );
  142.  
  143. const QRect clipRect = QwtScaleMap::transform( xMap, yMap, br ).toRect();
  144. d_directPainter->setClipRegion( clipRect );
  145. }
  146.  
  147. d_directPainter->drawSeries( d_curve,
  148. d_paintedPoints - 1, numPoints - 1 );
  149. d_paintedPoints = numPoints;
  150. }
  151.  
  152. data->values().unlock();
  153. }
To copy to clipboard, switch view to plain text mode 

The curvedata.h, curvedata.cpp, signaldata.h and signaldata.cpp are the same of the ocsilloscope example.

You need to copy this files on your project.

For append data only need to use the command:
Qt Code:
  1. SignalData::instance().append( QPointF value ); // where value is your data to append
To copy to clipboard, switch view to plain text mode 

For plot:
Qt Code:
  1. updateCurve();
To copy to clipboard, switch view to plain text mode 

I only have one doubt now, if I want to plot more than 1 signal in the same QwtPlot, how can I make this?

I hope I can be of help to some =)

And hope than someone can help me with this doubt. Thank you