Results 1 to 20 of 59

Thread: How i can plot result in my GUI ?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    May 2011
    Posts
    122
    Thanks
    34
    Platforms
    Windows

    Default Re: plot a curve during compilation

    thank you a lot, i like this example !!!
    i understand a little now


    Added after 1 33 minutes:


    i have try to plote something but it don't work (i don't show something)

    This is my main.cpp
    Qt Code:
    1. #include <qapplication.h>
    2. #include <qwt_plot.h>
    3. #include <qwt_plot_curve.h>
    4. #include <vector>
    5. #include "fonction.h"
    6.  
    7. using namespace std;
    8.  
    9. int main(int argc, char **argv)
    10. {
    11. QApplication a(argc, argv);
    12. QwtPlot plot;
    13. QwtPlotCurve *curve = new QwtPlotCurve();
    14.  
    15. for (int i=1;i<10;i++)
    16. {
    17. QPolygonF points;
    18. vector<double>coord;
    19. coord=fonction();
    20.  
    21. points << QPointF( coord[0],coord[1] ) ;
    22.  
    23. curve->attach( &plot );
    24. plot.replot();
    25. }
    26.  
    27. plot.resize(600,400);
    28. plot.show();
    29.  
    30. return a.exec();
    31. }
    To copy to clipboard, switch view to plain text mode 

    and my fonction:
    Qt Code:
    1. #include <vector>
    2. #include <ctime> // to generate random point
    3. #include <cstdlib> // to generate random point
    4. #include "fonction.h"
    5.  
    6. using namespace std;
    7.  
    8. vector<double> fonction()
    9. {
    10. vector<double> points;
    11. srand(time(0));
    12. points.clear();
    13.  
    14. points.push_back(rand() % 1800);
    15. points.push_back(rand() % 500);
    16.  
    17. return points;
    18. }
    To copy to clipboard, switch view to plain text mode 

    and his header:
    Qt Code:
    1. #ifndef FONCTION_H
    2. #define FONCTION_H
    3.  
    4. std::vector<double> fonction();
    5.  
    6. #endif // FONCTION_H
    To copy to clipboard, switch view to plain text mode 


    can you explain me, how i can plot this curve. I want to différente version: with line between point and without line
    Last edited by 21did21; 30th May 2011 at 23:45.

Similar Threads

  1. QRegExp - get only last result
    By kabanek in forum Newbie
    Replies: 2
    Last Post: 3rd November 2010, 22:17
  2. How to display result
    By sksingh73 in forum Newbie
    Replies: 1
    Last Post: 7th June 2010, 08:39
  3. QSqlQuery return result
    By arpspatel in forum Qt Programming
    Replies: 2
    Last Post: 9th April 2010, 07:55
  4. Result of DBUS call
    By conexion2000 in forum Qt Programming
    Replies: 4
    Last Post: 28th July 2009, 08:34
  5. Replies: 7
    Last Post: 22nd September 2008, 22:05

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.