Logo ROOT   6.08/07
Reference Guide
qtroot.h
Go to the documentation of this file.
1 #ifndef QTROOT_H
2 #define QTROOT_H
3 
4 #include "Riostream.h"
5 using namespace std;
6 
7 #include "qprinter.h"
8 #include "qstring.h"
9 #include "qthread.h"
10 #include "qtabwidget.h"
11 
12 #if QT_VERSION >= 0x40000
13 //Added by qt3to4:
14 #include <QPaintEvent>
15 #include <QResizeEvent>
16 #include <QMouseEvent>
17 #include <QCloseEvent>
18 #include "q3mainwindow.h"
19 #else
20 #include "qmainwindow.h"
21 typedef QMainWindow Q3MainWindow;
22 #endif
23 
24 #include "TObject.h"
25 #include "TCanvas.h"
26 #include "TVirtualX.h"
27 #include "TMethod.h"
28 #include "TMethodArg.h"
29 #include "TH1.h"
30 #include "TF1.h"
31 #include "TFormula.h"
32 #include "TPad.h"
33 #include "TSystem.h"
34 
35 #include "TQRootCanvas.h"
36 
37 
38 class QPrinter;
39 class QMouseEvent;
40 class QResizeEvent;
41 class QPaintEvent;
42 
43 /**
44  *
45  * Main Qt&Root Application Window:
46  *
47  * Simple Example how to use a QMainWindow class
48  * embedding a ROOT Canvas attached as its Central Widget.
49  *
50  *
51  * @short Simple example using
52  * QMainWindow together with an QRootCanvas
53  *
54  *
55  * Services:
56  * Simple example
57  * @li Creates a Menu for file actions (save, browse, close, ect...)
58  * @li Creates a Toolbar with actions managed by QAction class
59  * @li Creates a QRootCanvas and stick it as central Widget in QMainWindows
60  * @li Actions ( execute(), clear()) are defined as slots managed by this
61  * QMainApplication. This slots functions acts on the ROOT Objects
62  * directly ( histograms, ntuples, ect...)
63  *
64  * @see QRootCanvas, QMainWindow, QPopupMenu, QAction, QString
65  *
66  * @authors Denis Bertini <d.bertini@gsi.de>
67  * @version 2.0
68  *
69  */
70 
71 
73 {
74  Q_OBJECT
75 public:
78 
79 protected:
80  void closeEvent( QCloseEvent* ce);
81 
82  protected slots:
83  void myclose(){
84  close();
85  }
86  /**
87  New incoming functionality documentation
88  */
89  void newDoc();
90  /**
91  IO Loading:
92  @li ascii data files (Qt or ROOT streamers)
93  @li Root binary files(ROOT streamer)
94  @ etc...
95  */
96 
97  void load();
98  /**
99  IO Loading function:
100 
101  @li ascii data files (Qt or ROOT streamers)
102  @li Root binary files(ROOT streamer)
103  @ etc...
104  */
105  void load( const char *fileName );
106  /**
107  Saving results function:
108 
109  @li ascii data files
110  @li histograms, ntuples, Objects using
111  @li ROOT based IO (Root format)
112  @li Qt Based IO (Qt format)?
113 
114  @ etc...
115  */
116 
117  void save();
118  /**
119  saving pictures, in different supported formats
120  */
121  void saveAs();
122  /**
123  print results in a specified format
124  */
125  void print();
126  /**
127  online help about Qt&Root Main Application
128  */
129  void about();
130  /**
131  online help about this Qt based Application
132  */
133  void aboutQt();
134  /**
135  Main slot action upon ROOT classes
136  @li histograms
137  @li ntuples
138  */
139  void execute();
140 
141  /**
142  Main slot to reinitialize the objects
143  @li histograms
144  @li ntuples
145  */
146 
147  void clear_histo();
148  void closeQtRoot(){
149  qDebug("QtRoot: closing qt wins \n");
150  close();
151  qDebug("QtRoot: exiting root \n");
152  gSystem->Exit(0);
153  }
154 
155 private:
156  QString filename;
157  QPrinter *printer;
162  TPad* pad1,*pad2;
163  QTabWidget* tab;
164  QWidget* central;
165 };
166 
167 #endif
void closeQtRoot()
Definition: qtroot.h:148
QString filename
Definition: qtroot.h:156
void myclose()
Definition: qtroot.h:83
tomato 1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:575
QWidget * central
Definition: qtroot.h:164
STL namespace.
TQRootCanvas * aCanvas2
Definition: qtroot.h:158
QPrinter * printer
Definition: qtroot.h:157
Main Qt&Root Application Window:
Definition: qtroot.h:72
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
QMainWindow Q3MainWindow
Definition: qtroot.h:21
The F O R M U L A class.
Definition: TFormula.h:89
The most important graphics class in the ROOT system.
Definition: TPad.h:37
TH1F * histo
Definition: qtroot.h:159
QTabWidget * tab
Definition: qtroot.h:163
TFormula * form1
Definition: qtroot.h:161
virtual void Exit(int code, Bool_t mode=kTRUE)
Exit the application.
Definition: TSystem.cxx:721
1-Dim function class
Definition: TF1.h:149