Hi,
I am developing an application with Qwt and trying to get a scatter graph. I did the same thing by using Qframe class but I want to add few more functionality like zooming and printing.
So can you please help me this code just tell me where I am doing wrong.So far code is compiling fine with no errors but when I run the generated exe file it says"The appliction has requested the runtime to terminate in unsual way..." which I have seen is a kind of programming error.
#include <qapplication.h>
#include <qframe.h>
//#include <qwt_scale_map.h>
#include <qwt_plot_curve.h>
#include <qwt_symbol.h>
#include <qcolor.h>
#include <qpainter.h>
#include <math.h>
#include <qwt_plot.h>
//
// Array Sizes
//
const int Size = 26;
double xval[Size];
double yval[Size];
QwtScaleMap xMap;
QwtScaleMap yMap;
//QwtPlot *myPlot = new QwtPlot(QWidget parent = NULL);
QwtPlotCurve *curve1 = new QwtPlotCurve();
class MainWin : public QwtPlot
{
public:
MainWin( );
};
MainWin::MainWin()
{
int i;
QwtPlot *myPlot;
myPlot= new QwtPlot();
//xMap.setScaleInterval(-0.5, 10.5);
// yMap.setScaleInterval(-1.1, 1.1);
//
// Calculate values
//
for(i=0; i<Size;i++)
{ xval[i] = double(i) * 10.0 / double(Size - 1);
yval[i] = sin(xval[i]) * cos(2.0 * xval[i]);
}
//myplot->setCurveData(c1, xval, yval, 100);
curve1->setRawData(xval,yval,Size);
curve1->attach(myPlot);
//curve1->attach(&plot);
myPlot->replot();
}
int main (int argc, char **argv)
{
QApplication a(argc, argv);
MainWin w;
// w.resize(300,500);
w.show();
return a.exec();
}
I would really appreciate your help.
Cheers,
Bookmarks