Results 1 to 3 of 3

Thread: qwtplot run time error

  1. #1
    Join Date
    Jun 2009
    Posts
    27
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X

    Default qwtplot run time error

    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,

  2. #2
    Join Date
    Aug 2009
    Posts
    33
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qwtplot run time error

    class MainWin : public QwtPlot

    this means you don't have to create a QwtPlot *myPlot; for displaying the plot

    you shoud only do curve1->attach(this);

    and than replot

    I don't know if this is the problem but you should try

  3. #3
    Join Date
    Jun 2009
    Posts
    27
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: qwtplot run time error

    Thanks Eme,

    I did the changes but error is still the same... Also I am trying to find the exact error by using DrMingw but I dont know how to read the resulted file from DrMingw.

    Any other suggestion.

    Cheers,

Similar Threads

  1. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 13:43
  2. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 12:57
  3. Error compiling psql plugin
    By vieraci in forum Installation and Deployment
    Replies: 4
    Last Post: 7th October 2007, 02:49
  4. qt 4.2.2 install on aix
    By try to remember in forum Installation and Deployment
    Replies: 2
    Last Post: 28th March 2007, 12:19
  5. Qt-x11-commercial-src-4.2.0-snapshot-20060824 error
    By DevObject in forum Installation and Deployment
    Replies: 4
    Last Post: 24th August 2006, 23:31

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.