qtroot.h

Go to the documentation of this file.
00001 #ifndef QTROOT_H
00002 #define QTROOT_H
00003 
00004 #include "Riostream.h"
00005 using namespace std;
00006 
00007 #include "qprinter.h"
00008 #include "qstring.h"
00009 #include "qthread.h"
00010 #include "qtabwidget.h"
00011 
00012 #if QT_VERSION >= 0x40000
00013 //Added by qt3to4:
00014 #include <QPaintEvent>
00015 #include <QResizeEvent>
00016 #include <QMouseEvent>
00017 #include <QCloseEvent>
00018 #include "q3mainwindow.h"
00019 #else
00020 #include "qmainwindow.h"
00021 typedef QMainWindow Q3MainWindow;
00022 #endif
00023 
00024 #include "TObject.h"
00025 #include "TCanvas.h"
00026 #include "TVirtualX.h"
00027 #include "TMethod.h"
00028 #include "TMethodArg.h"
00029 #include "TH1.h"
00030 #include "TF1.h"
00031 #include "TFormula.h"
00032 #include "TPad.h"
00033 #include "TSystem.h"
00034 
00035 #include "TQRootCanvas.h"
00036 
00037 
00038 class QPrinter;
00039 class QMouseEvent;
00040 class QResizeEvent;
00041 class QPaintEvent;
00042 
00043 /**
00044 * 
00045 *           Main Qt&Root Application Window:
00046 *
00047 *           Simple Example how to use a QMainWindow class 
00048 *           embedding a ROOT Canvas attached as its Central Widget.      
00049 *
00050 *
00051 * @short Simple example using 
00052 *        QMainWindow together with an QRootCanvas  
00053 *        
00054 *  
00055 * Services:
00056 * Simple example  
00057 * @li Creates a Menu for file actions (save, browse, close, ect...)  
00058 * @li Creates a Toolbar with actions managed by QAction class
00059 * @li Creates a QRootCanvas and stick it  as central Widget in QMainWindows
00060 * @li Actions ( execute(), clear()) are defined as slots managed by this
00061 *              QMainApplication. This slots functions acts on the ROOT Objects
00062 *               directly ( histograms, ntuples, ect...)
00063 *
00064 * @see QRootCanvas, QMainWindow, QPopupMenu, QAction, QString
00065 *
00066 * @authors Denis Bertini <d.bertini@gsi.de> 
00067 * @version 2.0
00068 *
00069 */
00070 
00071 
00072 class ApplicationWindow: public Q3MainWindow
00073 {
00074     Q_OBJECT
00075 public:
00076     ApplicationWindow();
00077     ~ApplicationWindow();
00078 
00079 protected:
00080     void closeEvent( QCloseEvent* ce);
00081     
00082 protected slots:
00083       void myclose(){
00084            close(); 
00085       }
00086    /**
00087       New incoming functionality documentation
00088     */   
00089     void newDoc();
00090    /**
00091      IO  Loading:
00092              @li ascii data files (Qt or ROOT streamers)
00093              @li Root binary files(ROOT streamer)
00094              @ etc...
00095    */  
00096  
00097     void load();
00098    /**
00099      IO  Loading function:
00100 
00101              @li ascii data files (Qt or ROOT streamers)
00102              @li Root binary files(ROOT streamer)
00103              @ etc...
00104    */  
00105     void load( const char *fileName );
00106    /**
00107       Saving results function:
00108 
00109              @li ascii data files
00110              @li histograms, ntuples, Objects using
00111                            @li ROOT based IO (Root format)
00112                            @li Qt Based  IO (Qt format)?
00113 
00114              @ etc...
00115    */ 
00116 
00117     void save();
00118    /**
00119        saving pictures, in different supported formats
00120    */ 
00121     void saveAs();
00122     /**
00123        print results in a specified format
00124     */ 
00125     void print();
00126     /**
00127        online help about Qt&Root Main Application
00128     */ 
00129     void about();
00130     /**
00131        online help about this Qt based Application
00132     */ 
00133     void aboutQt();
00134     /**
00135       Main slot action upon ROOT classes
00136              @li histograms
00137              @li ntuples
00138     */   
00139     void execute();
00140 
00141      /**
00142       Main slot to reinitialize the objects
00143             @li histograms
00144             @li ntuples
00145      */ 
00146 
00147     void clear_histo(); 
00148     void closeQtRoot(){
00149       qDebug("QtRoot:  closing qt wins \n");
00150       close(); 
00151       qDebug("QtRoot:  exiting root \n");
00152       gSystem->Exit(0); 
00153     }
00154 
00155 private:
00156     QString filename;
00157     QPrinter *printer;
00158     TQRootCanvas *aCanvas,*aCanvas2;     
00159     TH1F* histo; 
00160     TF1 *sqroot; 
00161     TFormula *form1; 
00162     TPad* pad1,*pad2; 
00163     QTabWidget* tab;
00164     QWidget* central;
00165 };
00166 
00167 #endif

Generated on Tue Jul 5 14:22:21 2011 for ROOT_528-00b_version by  doxygen 1.5.1