I found this example hidden in the code as commented, but it cannot be compiled. This looks to be a simple application of Qwt, and it is almost what I need to start with and to learn some basics.
#include <cmath>
#include <qwt_series_data.h>
#include <qwt_plot_curve.h>
#include <qwt_plot.h>
#include <qapplication.h>
class SinusData: public QwtSyntheticPointData
{
public:
SinusData():
QwtSyntheticPointData(100)
{
}
virtual double y(double x) const
{
return qSin(x);
}
};
int main(int argc, char **argv)
{
plot.
setAxisScale(QwtPlot::xBottom,
0.0,
10.0);
plot.
setAxisScale(QwtPlot::yLeft,
-1.0,
1.0);
curve->setData(SinusData());
curve->attach(&plot);
plot.show();
return a.exec();
}
#include <cmath>
#include <qwt_series_data.h>
#include <qwt_plot_curve.h>
#include <qwt_plot.h>
#include <qapplication.h>
class SinusData: public QwtSyntheticPointData
{
public:
SinusData():
QwtSyntheticPointData(100)
{
}
virtual double y(double x) const
{
return qSin(x);
}
};
int main(int argc, char **argv)
{
QApplication a(argc, argv);
QwtPlot plot;
plot.setAxisScale(QwtPlot::xBottom, 0.0, 10.0);
plot.setAxisScale(QwtPlot::yLeft, -1.0, 1.0);
QwtPlotCurve *curve = new QwtPlotCurve("y = sin(x)");
curve->setData(SinusData());
curve->attach(&plot);
plot.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
This is what I get as error:
..\sinus\main.cpp: In function 'int qMain(int, char**)':
..\sinus\main.cpp:29: error: no matching function for call to 'QwtPlotCurve::setData(SinusData)'
..\sinus\libraries\qwt/qwt_plot_seriesitem.h:146: note: candidates are: void QwtPlotSeriesItem<T>::setData(QwtSeriesData<T>*) [with T = QPointF]
mingw32-make[1]: *** [release/main.o] Error 1
If you can fix this code for me, I think I will be able to extend it with more. Thanx in advance!
Bookmarks