[Qt-interest] Qwt Error
Sujan Dasmahapatra
sdh at lmglasfiber.com
Tue May 5 09:17:53 CEST 2009
Dear Friends
I have installed Qwt for plotting when I am trying to compile the give
tutorial code I ma getting a lot of errors..Mostly I think because of
header file inclusion or .pro file add ons......Can u say anyone how
could I compile this piece of code for Qwt.
What header files if at all I need to include and what I have to specify
in the .pro file plss help me...
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//////////////////
/////////////////main.cpp
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//////////////////
class MyPlot : public QwtPlot
{
public:
MyPlot( QWidget *parent=0, char *name=0 ) : QwtPlot( parent, name )
{
// Show a title
setTitle( "This is an Example" );
// Show a legend at the bottom
setAutoLegend( true );
setLegendPos( Qwt::Bottom );
// Show the axes
setAxisTitle( xBottom, "x" );
setAxisTitle( yLeft, "y" );
// Insert two curves and get IDs for them
long cSin = insertCurve( "y = sin(x)" );
long cSign = insertCurve( "y = sign(sin(x))" );
// Calculate the data, 500 points each
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);
}
// Copy the data to the plot
setCurveData( cSin, x, sn, points );
setCurveData( cSign, x, sg, points );
// Set the style of the curves
setCurvePen( cSin, QPen( blue ) );
setCurvePen( cSign, QPen( green, 3 ) );
// Show the plots
replot();
}
};
int main( int argc, char **argv )
{
QApplication a( argc, argv );
MyPlot p;
a.setMainWidget( &p );
p.show();
return a.exec();
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/////////////////////////////////////
Kind regards,
LM Glasfiber R&D (India) Pvt. Ltd.
Sujan Dasmahapatra
Project Engineer - CFD
Telephone: +91 80 66470248
Mobile:
E-mail: sdh at lmglasfiber.com <mailto:sdh at lmglasfiber.com>
--------------------------------------------------------------
This e-mail and any attachments are confidential. If you are not the
named or intended recipient, please notify the sender immediately and do
not disclose the contents to any other person, use it for any purpose or
store or copy the information in any medium. Any unauthorized
disclosure, use or storage is prohibited and might be unlawful.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090505/34258707/attachment.html
More information about the Qt-interest-old
mailing list