Hi, thanks for your help.
I tried to run that example but I get a bunch of errors, am I forgetting to include something?
#include <qapplication.h>
#include <qwt_plot.h>
{
public:
{
setTitle( "This is an Example" );
setAutoLegend( true );
setLegendPos( Qwt::Bottom );
setAxisTitle( xBottom, "x" );
setAxisTitle( yLeft, "y" );
long cSin = insertCurve( "y = sin(x)" );
long cSign = insertCurve( "y = sign(sin(x))" );
const int points = 500;
double x[ points ];
double sn[ points ];
double sg[ points ];
for( int i=0; i<points; i++ )
{
x[i] = (3.0*3.14/double(points))*double(i);
sn[i] = 2.0*sin( x[i] );
sg[i] = (sn[i]>0)?1:((sn[i]<0)?-1:0);
}
setCurveData( cSin, x, sn, points );
setCurveData( cSign, x, sg, points );
setCurvePen
( cSin,
QPen( blue
) );
setCurvePen
( cSign,
QPen( green,
3 ) );
replot();
}
};
int main( int argc, char **argv )
{
MyPlot p;
a.setMainWidget( &p );
p.show();
return a.exec();
}
#include <qapplication.h>
#include <qwt_plot.h>
class MyPlot : public QwtPlot
{
public:
MyPlot( QWidget *parent=0, char *name=0 ) : QwtPlot( parent, name )
{
setTitle( "This is an Example" );
setAutoLegend( true );
setLegendPos( Qwt::Bottom );
setAxisTitle( xBottom, "x" );
setAxisTitle( yLeft, "y" );
long cSin = insertCurve( "y = sin(x)" );
long cSign = insertCurve( "y = sign(sin(x))" );
const int points = 500;
double x[ points ];
double sn[ points ];
double sg[ points ];
for( int i=0; i<points; i++ )
{
x[i] = (3.0*3.14/double(points))*double(i);
sn[i] = 2.0*sin( x[i] );
sg[i] = (sn[i]>0)?1:((sn[i]<0)?-1:0);
}
setCurveData( cSin, x, sn, points );
setCurveData( cSign, x, sg, points );
setCurvePen( cSin, QPen( blue ) );
setCurvePen( cSign, QPen( green, 3 ) );
replot();
}
};
int main( int argc, char **argv )
{
QApplication a( argc, argv );
MyPlot p;
a.setMainWidget( &p );
p.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
these are the errors I get:
1>(16) : error C2664: 'QwtPlot::QwtPlot(const QwtText &,QWidget *)' : cannot convert parameter 1 from 'QWidget *' to 'const QwtText &'
1> Reason: cannot convert from 'QWidget *' to 'const QwtText'
1> No constructor could take the source type, or constructor overload resolution was ambiguous
1>(21) : error C3861: 'setAutoLegend': identifier not found
1>(22) : error C2653: 'Qwt' : is not a class or namespace name
1>(22) : error C2065: 'Bottom' : undeclared identifier
1>(22) : error C3861: 'setLegendPos': identifier not found
1>(29) : error C3861: 'insertCurve': identifier not found
1>(30) : error C3861: 'insertCurve': identifier not found
1>(47) : error C3861: 'setCurveData': identifier not found
1>(48) : error C3861: 'setCurveData': identifier not found
1>(51) : error C2065: 'blue' : undeclared identifier
1>(51) : error C3861: 'setCurvePen': identifier not found
1>(52) : error C2065: 'green' : undeclared identifier
1>(52) : error C3861: 'setCurvePen': identifier not found
1>(64) : error C2039: 'setMainWidget' : is not a member of 'QApplication'
1> (95) : see declaration of 'QApplication'
1>(16) : error C2664: 'QwtPlot::QwtPlot(const QwtText &,QWidget *)' : cannot convert parameter 1 from 'QWidget *' to 'const QwtText &'
1> Reason: cannot convert from 'QWidget *' to 'const QwtText'
1> No constructor could take the source type, or constructor overload resolution was ambiguous
1>(21) : error C3861: 'setAutoLegend': identifier not found
1>(22) : error C2653: 'Qwt' : is not a class or namespace name
1>(22) : error C2065: 'Bottom' : undeclared identifier
1>(22) : error C3861: 'setLegendPos': identifier not found
1>(29) : error C3861: 'insertCurve': identifier not found
1>(30) : error C3861: 'insertCurve': identifier not found
1>(47) : error C3861: 'setCurveData': identifier not found
1>(48) : error C3861: 'setCurveData': identifier not found
1>(51) : error C2065: 'blue' : undeclared identifier
1>(51) : error C3861: 'setCurvePen': identifier not found
1>(52) : error C2065: 'green' : undeclared identifier
1>(52) : error C3861: 'setCurvePen': identifier not found
1>(64) : error C2039: 'setMainWidget' : is not a member of 'QApplication'
1> (95) : see declaration of 'QApplication'
To copy to clipboard, switch view to plain text mode
That setCurveData seems like just what I need..... hmmmmm
Bookmarks