PSQt/app/test_QGraphicsView.cpp

Go to the documentation of this file.
00001 //=======================
00002 
00003 #include <PSQt/GUAxes.h>
00004 #include <PSQt/QGUtils.h> // for PSQt::graph
00005 //#include <PSQt/GURuler.h>
00006 //#include <PSQt/GUView.h>
00007 
00008 #include <QtGui/QApplication>
00009 
00010 #include <cmath>     // for sin, cos
00011 #include <iostream>  // for std::cout
00012 
00013 int main(int argc, char *argv[])
00014 {
00015   QApplication a(argc, argv);
00016 
00017   float xmin = 0;
00018   float xmax = 30;
00019   float ymin = -4;
00020   float ymax = 12;
00021   unsigned pbits=1;
00022 
00023   unsigned npts = 1000;
00024   float x1[npts];
00025   float y1[npts];
00026   float y2[npts];
00027   float y3[npts];
00028   float dx = (xmax-xmin)/(npts+1);
00029 
00030   unsigned i=0;
00031   for(float x=xmin; x<xmax; x+=dx, i++) {
00032     x1[i]   = x;
00033     y1[i] = 4*sin(x);
00034     y2[i] = 3*cos(5*x);
00035     y3[i] = (x>0) ? ymax*sin(x)/x : ymax;
00036     //i++;
00037   }
00038 
00039   PSQt::GUAxes* pax1 = new PSQt::GUAxes(0, xmin, xmax, ymin, ymax, pbits);
00040   //pax1->setGeometry(200, 30, 800, 600);
00041 
00042   PSQt::graph(pax1, x1, y1, npts, "-rT4");
00043   PSQt::graph(pax1, x1, y2, npts, "-kT");
00044   PSQt::graph(pax1, x1, y3, npts, "-bT");
00045 
00046   // Show the view
00047    //pax1->pview()->show();
00048   pax1->show();
00049 
00050   //QGraphicsView  * view = pax1->pview();
00051   //QGraphicsScene * view = pax1->pscene();
00052   //QTransform trans = pax1->transform() 
00053 
00054   return a.exec();
00055 }
00056 
00057 

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7