Results 1 to 4 of 4

Thread: Example from "Qwt User's Guide" doesn't work

  1. #1
    Join Date
    Nov 2012
    Posts
    232
    Thanks
    118
    Thanked 18 Times in 10 Posts
    Platforms
    Windows Android

    Default Example from "Qwt User's Guide" doesn't work

    Hi

    Example from "Qwt User's Guide" doesn't work: http://qwt.sourceforge.net/class_qwt...oint_data.html

    Output
    C:\Users\Ivan\qt_projects\qwt\Sin\main.cpp:29: error: no matching function for call to 'QwtPlotCurve::setData(SinusData)'
    c:\Qwt-6.0.2\include\qwt_plot_seriesitem.h:168: candidates are: void QwtPlotSeriesItem<T>::setData(QwtSeriesData<T>*) [with T = QPointF]
    Qt Code:
    1. #include <cmath>
    2. #include <qwt_series_data.h>
    3. #include <qwt_plot_curve.h>
    4. #include <qwt_plot.h>
    5. #include <qapplication.h>
    6.  
    7. class SinusData: public QwtSyntheticPointData
    8. {
    9. public:
    10. SinusData():
    11. QwtSyntheticPointData(100)
    12. {
    13. }
    14. virtual double y(double x) const
    15. {
    16. return qSin(x);
    17. }
    18. };
    19.  
    20. int main(int argc, char **argv)
    21. {
    22. QApplication a(argc, argv);
    23.  
    24. QwtPlot plot;
    25. plot.setAxisScale(QwtPlot::xBottom, 0.0, 10.0);
    26. plot.setAxisScale(QwtPlot::yLeft, -1.0, 1.0);
    27.  
    28. QwtPlotCurve *curve = new QwtPlotCurve("y = sin(x)");
    29. curve->setData(SinusData());
    30. curve->attach(&plot);
    31.  
    32. plot.show();
    33. return a.exec();
    34. }
    To copy to clipboard, switch view to plain text mode 

    Thanks
    Last edited by 8Observer8; 3rd March 2013 at 13:35.

  2. #2
    Join Date
    Nov 2012
    Posts
    232
    Thanks
    118
    Thanked 18 Times in 10 Posts
    Platforms
    Windows Android

    Default Re: Example from "Qwt User's Guide" doesn't work

    It's very important for me. Please, help me!

    Why this line doesn't work:

    Qt Code:
    1. curve->setData(SinusData());
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Example from "Qwt User's Guide" doesn't work

    A "new" is missing in the docs - that's all. But this something the compiler told you already.

    Uwe

  4. The following user says thank you to Uwe for this useful post:

    8Observer8 (3rd March 2013)

  5. #4
    Join Date
    Nov 2012
    Posts
    232
    Thanks
    118
    Thanked 18 Times in 10 Posts
    Platforms
    Windows Android

    Default Re: Example from "Qwt User's Guide" doesn't work

    Thanks! I'm happy

    Qt Code:
    1. curve->setData(new SinusData());
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 2
    Last Post: 27th January 2012, 17:29
  2. Save log file to "all user\application data\"
    By stella1016 in forum Qt Programming
    Replies: 3
    Last Post: 4th July 2011, 16:01
  3. Replies: 3
    Last Post: 17th November 2008, 08:48
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. QModelIndex destructor causes "user breakpoint"
    By Arthur in forum Qt Programming
    Replies: 2
    Last Post: 30th March 2006, 09:11

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.