Reputation: 4136
QVector<double> x(101), y(101);
for (int i=0; i<101; ++i)
{
x[i] = i/50.0 - 1;
y[i] = x[i]*x[i];
}
QwtPlotCurve *curve;
curve->setData(x,y);
curve->attach(plot_all[0]);
Assuming plot_all[0]
is my QwtPlot, what wrong here? It crashes my program, made in linux.
Upvotes: 0
Views: 1578
Reputation: 12975
You are not allocating *curve
so it does not point to a valid object. Try replacing QwtPlotCurve *curve
with
QwtPlotCurve *curve = new QwtPlotCurve();
Upvotes: 2