在qwt安装包内的examples下的simple_plot例子下的cSin->setData(SimpleData(::sin, nPoints));是什么意思?看不懂?
class SimpleData: public QwtData
{
// The x values depend on its index and the y values
// can be calculated from the corresponding x value.
// So we don磘 need to store the values.
// Such an implementation is slower because every point
// has to be recalculated for every replot, but it demonstrates how
// QwtData can be used.
public:
SimpleData(double(*y)(double), size_t size):
d_size(size),
d_y(y)
{
}
virtual QwtData *copy() const
{
return new SimpleData(d_y, d_size);
}
virtual size_t size() const
{
return d_size;
}
virtual double x(size_t i) const
{
return 0.1 * i;
}
virtual double y(size_t i) const
{
return d_y(x(i));
}
private:
size_t d_size;
double(*d_y)(double);
};