PDA

View Full Version : how to create a curve in qwtplot?



ethanfeng
26th March 2011, 08:38
hello everyone:)
I have a problem with using qwtplot.
I want to put a qwtplot and a pushbutton in mainwindow.when the pushbutton clicked,sine curve comes out.
I have read several examples.
but I found that those qwtplot examples have no XXX.ui within.
I try copy

QwtPlotCurve *cSin = new QwtPlotCurve("y = sin(x)");
#if QT_VERSION >= 0x040000
cSin->setRenderHint(QwtPlotItem::RenderAntialiased);
#endif
cSin->setPen(QPen(Qt::red));
cSin->attach(this);
const int nPoints = 100;
cSin->setData(SimpleData(::sin, nPoints));

in the pushbutton_clicked() ,
but it shows "error: 'SimpleData' was not declared in this scope"

:crying:can you help me??

Uwe
27th March 2011, 09:05
Even if you try to implement a Qwt application this is a C++ beginner question and should be asked in such a forum.

Uwe