QwtPlot sending runtime exception when trying to show a curve with 8000 points
-
I'm trying to show two curves in a QwtPlot and replot each 20 miliseconds. But when I run my program it throws a runtime exception.
Here are my variables:
@QwtPlot * spectrum = new QwtPlot();
QwtPlotCurve * Tcurve = new QwtPlotCurve();
QwtPlotCurve * Scurve = new QwtPlotCurve();
QpolygonF Tpoints;
QpolygonF Spoints;
const int count = 1;@And here is the code for every time I replot spectrum :
@for(i=0;i<4006;i+=count)
{
Tpoints << QPointF(i,intArray[i]);
}
for(;i<8012;i+=count)
{
Spoints << QPointF(i-4005,intArray[i]);
}Tcurve->setSamples(Tpoints);
Scurve->setSamples(Spoints);Tcurve->attach(spectrum);
Scurve->attach(spectrum);spectrum->replot();@
The intArray array is updated every millisecond through a UDP socket connection but the spectrum is updated each 20 milliseconds.
Farther info: The size of the QwtPlot is 1000x280
Thank you in advance for your help,
-
Thank You :)
Yes, I set it to 100 milliseconds, 1 second and 2 seconds, still the same.
I'm using qwt 6.1.0, with Qt 5.1.1 MinGW 32bit compiler and in Windows.When I reduce the number of points the exception does not occur but unfortunately I need all of the points shown.
I have also set a QwtPlotZoomer for the plot, when I set count to 2 and zoom in just after the program starts the exception does not appear but when I zoom out the exception is instantly thrown. It's like the plot can't show all the 8000 points together... -
I am using the same configuration, but still Qt 5.1.0. I have much more points. Therefore, I guess it should not be an issue in your case either.
I looks more that something might not be initialized. debug and release versions do show the same problem?
Can you start it in debugger? This gives you generally quite a good guess where to search. -
I used both the debug and release versions and in got the exception in both.
I also ran the debugger which gave me a signal with : "Signal meaning: Segmentation fault" -
I did a little search around segmentation fault in this case, gonna change my Qt version to see if that will make a difference.