title: Plot only part of QwtCurve in real time plot
body: <p>I have a QVector in which I'm constantly appending data so I can plot on a QwtPlot. But with a high frequency I guess the vector becames too large and the program crashes.</p>
  
  <p>My question is, how can I create a QwtCurve which is only beggining in some point of time, bacause the time that has already passed is not necessary in the vector as it was already plotted.</p>
  
  <p>here's my code:</p>
  
  <pre><code>QVector&lt;double&gt; xv;
  QVector&lt;double&gt; cv1;
  QVector&lt;double&gt; cv2;
  </code></pre>
  
  <p>as global variables,</p>
  
  <pre><code>void gui::process_new_info(QByteArray array)
  {
      int v = 0;
  
      double f = ui-&gt;frequency-&gt;value();
  
      xv.append(sizeof_array/f);
  
      char *buf = array.data();
  
      if (ui-&gt;ecgPlux-&gt;isChecked() == true || ui-&gt;channel_1-&gt;currentIndex() != 0)
      {
          cv1.append(buf[1]);
  
          QwtPlotCurve *curve1 = new QwtPlotCurve;
          curve1-&gt;attach(plot_all[0]);
          curve1-&gt;setData(xv,cv1);
          curve1-&gt;setPen(QPen(Qt::blue,1));
          plot_all[0]-&gt;replot();
  
          QwtPlotCurve *curve2 = new QwtPlotCurve;
          curve2-&gt;attach(plot[0]);
          curve2-&gt;setData(xv,cv1);
          curve2-&gt;setPen(QPen(Qt::blue,1));
          plot[0]-&gt;replot();
      }
  
      if (ui-&gt;xyzPlux-&gt;isChecked() == true || ui-&gt;channel_2-&gt;currentIndex() != 0)
      {
          cv2.append(buf[2]);
  
          QwtPlotCurve *curve3 = new QwtPlotCurve;
          curve3-&gt;attach(plot_all[1]);
          curve3-&gt;setData(xv,cv2);
          curve3-&gt;setPen(QPen(Qt::blue,1));
          plot_all[0]-&gt;replot();
  
          QwtPlotCurve *curve4 = new QwtPlotCurve;
          curve4-&gt;attach(plot[1]);
          curve4-&gt;setData(xv,cv1);
          curve4-&gt;setPen(QPen(Qt::blue,1));
          plot[1]-&gt;replot();
      }
  
      //printf ("%d -&gt;", buf[0]);
      fprintf (data, "%d,", buf[0]);
  
      for (int i = 1; i &lt; 9; i++)
      {
          v = buf[i];
          //printf ("%d,", v);
          fprintf (data, "%d,", v);
      }
  
      //printf ("\n");
      fprintf (data, "\n");
  
      sizeof_array++;
  }
  </code></pre>