For plotting the graph I'm using QcustomPlot. My question is: How to plot a graph into an infinite loop with a few second delay of a random variable to whom a cancel button is pressed?

Qt Code:
  1. QVector<double> x(101), y(101);
  2. for (int i=0; i<101; ++i)
  3. {
  4. x[i] = i;
  5. y[i] = i;
  6. }
  7.  
  8. customPlot->addGraph();
  9. customPlot->graph(0)->setData(x, y);
  10. customPlot->xAxis->setLabel("x");
  11. customPlot->yAxis->setLabel("y");
  12. customPlot->xAxis->setRange(-1, 1);
  13. customPlot->yAxis->setRange(0, 1);
  14. customPlot->replot();
To copy to clipboard, switch view to plain text mode