7 #if QT_VERSION >= 0x40000 10 #include "q3toolbar.h" 11 #include "q3filedialog.h" 12 #include "q3strlist.h" 13 #include "q3popupmenu.h" 14 #include "q3intdict.h" 16 #include "q3toolbar.h" 17 #include "qnamespace.h" 18 #include "q3filedialog.h" 19 #include "q3whatsthis.h" 20 #include "Q3MimeSourceFactory" 22 #include "qfiledialog.h" 24 #include "qpopupmenu.h" 28 #include "qnamespace.h" 29 #include "qfiledialog.h" 30 #include "qwhatsthis.h" 44 #include "qtoolbutton.h" 49 #include "qcolordialog.h" 52 #include "qpushbutton.h" 56 #include "qapplication.h" 59 #include "qtoolbutton.h" 62 #include "qstatusbar.h" 63 #include "qmessagebox.h" 68 #include "filesave.xpm" 69 #include "fileopen.xpm" 70 #include "fileprint.xpm" 71 #include "qtbuttonsupdate.xpm" 72 #include "qtbuttonsclear.xpm" 98 "Click this button to open a <em>new file</em>. <br><br>" 99 "You can also select the <b>Open command</b> from the File menu.";
100 const char *
fileSaveText =
"Click this button to save the file you are " 101 "editing. You will be prompted for a file name.\n\n" 102 "You can also select the Save command from the File menu.\n\n" 103 "Note that implementing this function is left as an exercise for the reader.";
106 "You can also select the Print command from the File menu.";
117 :
Q3MainWindow( 0,
"example application main window",
Qt::WDestructiveClose )
123 Q3Action *fileNewAction =
new Q3Action(
"New",
"&New", Qt::CTRL+Qt::Key_N,
this,
"new" );
125 connect( fileNewAction, SIGNAL( activated() ) ,
this, SLOT(
newDoc() ) );
127 Q3Action *fileOpenAction =
new Q3Action(
"Open File", QPixmap( fileopen ),
"&Open", Qt::CTRL+Qt::Key_O,
this,
"open" );
128 connect( fileOpenAction, SIGNAL( activated() ) ,
this, SLOT(
load() ) );
129 Q3MimeSourceFactory::defaultFactory()->setPixmap(
"fileopen", QPixmap( fileopen ) );
132 Q3Action *fileSaveAction =
new Q3Action(
"Save File", QPixmap( filesave ),
"&Save", Qt::CTRL+Qt::Key_S,
this,
"save" );
133 connect( fileSaveAction, SIGNAL( activated() ) ,
this, SLOT(
save() ) );
136 Q3Action *fileSaveAsAction =
new Q3Action(
"Save File As",
"Save &as", 0,
this,
"save as" );
137 connect( fileSaveAsAction, SIGNAL( activated() ) ,
this, SLOT(
saveAs() ) );
140 Q3Action *filePrintAction =
new Q3Action(
"Print File", QPixmap( fileprint ),
"&Print", Qt::CTRL+Qt::Key_P,
this,
"print" );
141 connect( filePrintAction, SIGNAL( activated() ) ,
this, SLOT(
print() ) );
144 Q3Action *fileCloseAction =
new Q3Action(
"Close",
"&Close", Qt::CTRL+Qt::Key_W,
this,
"close" );
145 connect( fileCloseAction, SIGNAL( activated() ) ,
this, SLOT(
close() ) );
147 Q3Action *fileQuitAction =
new Q3Action(
"Quit",
"&Quit", Qt::CTRL+Qt::Key_Q,
this,
"quit" );
148 connect( fileQuitAction, SIGNAL( activated() ) , qApp, SLOT( quit() ) );
151 Q3Action *Update_histo =
new Q3Action(
"Update Histo",QPixmap(
"qtbuttonsupdate.xpm"),
"&Update", Qt::CTRL+Qt::Key_0,
this,
"update");
152 connect( Update_histo, SIGNAL( activated() ) ,
this, SLOT(
execute() ) );
153 Q3MimeSourceFactory::defaultFactory()->setPixmap(
"update", QPixmap(
"qtbuttonsupdate.xpm" ) );
156 Q3Action *
clear_histo =
new Q3Action(
"Clear Histo",QPixmap(
"qtbuttonsclear.xpm"),
"&Clear", Qt::CTRL+Qt::Key_0,
this,
"clear"); connect( clear_histo, SIGNAL( activated() ) ,
this, SLOT(
clear_histo() ) );
157 Q3MimeSourceFactory::defaultFactory()->setPixmap(
"clear", QPixmap(
"qtbuttonsclear.xpm" ) );
163 fileTools->setLabel( tr(
"File Operations" ) );
164 fileOpenAction->addTo( fileTools );
165 fileSaveAction->addTo( fileTools );
166 filePrintAction->addTo( fileTools );
167 Update_histo->addTo ( fileTools );
168 clear_histo->addTo ( fileTools );
169 (
void)Q3WhatsThis::whatsThisButton( fileTools );
173 menuBar()->insertItem(
"&File", file );
174 fileNewAction->addTo( file );
175 fileOpenAction->addTo( file );
176 fileSaveAction->addTo( file );
177 fileSaveAsAction->addTo( file );
178 file->insertSeparator();
179 filePrintAction->addTo( file );
180 file->insertSeparator();
181 fileCloseAction->addTo( file );
182 fileQuitAction->addTo( file );
187 menuBar()->insertSeparator();
188 menuBar()->insertItem(
"&Help", help );
189 help->insertItem(
"&About",
this, SLOT(
about()), Qt::Key_F1 );
190 help->insertItem(
"About &Qt",
this, SLOT(
aboutQt()) );
191 help->insertSeparator();
192 help->insertItem(
"What's &This",
this, SLOT(whatsThis()),
Qt::SHIFT+Qt::Key_F1 );
195 tab =
new QTabWidget(
this);
197 setCentralWidget(
tab );
204 win1->setCentralWidget(
aCanvas);
208 tab->addTab(win1,
"page1");
209 tab->addTab(win2,
"page2");
226 pad1 =
new TPad(
"pad1",
"The pad with the function",0.05,0.50,0.95,0.95,21);
235 histo=
new TH1F(
"hppx",
"Gaussian distribution",100,-4,4);
240 pad2 =
new TPad(
"pad2",
"The pad with the histogram",0.05,0.05,0.95,0.45,21);
245 sqroot =
new TF1(
"sqroot",
"x*gaus(0) + [3]*form1",0,10);
286 qDebug(
" ~ApplicationWindow() \n");
298 gROOT->GetSelectedPad()->Modified();
299 gROOT->GetSelectedPad()->Update();
312 for (
Int_t i = 0; i < 25000; i++) {
316 if (i && (i%kUPDATE) == 0) {
340 statusBar()->message(
"Loading aborted", 2000 );
361 int testvar = QMessageBox::information( 0,
"Qt Application Example",
362 "Do you want to close QtRoot? " 363 "",
"Save",
"Cancel",
"Close",
382 qDebug(
"detecting fitpanel %x \n",fitpanel);
386 qDebug(
"detecting drawpanel %x \n",drawpanel);
396 QMessageBox::about(
this,
"Qt&ROOT Application Example",
397 "This example demonstrates simple use of " 398 "QMainWindow,\nQMenuBar and QToolBar.");
403 QMessageBox::aboutQt(
this,
"Qt Application Example" );
virtual void SetGridx(Int_t value=1)
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
void aboutQt()
online help about this Qt based Application
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
void clear_histo()
Main slot to reinitialize the objects.
virtual void SetParameters(const Double_t *params)
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
void print()
print results in a specified format
virtual void SetBorderMode(Short_t bordermode)
THist< 1, float, THistStatContent, THistStatUncertainty > TH1F
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
void execute()
Main slot action upon ROOT classes.
virtual void SetYTitle(const char *title)
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
const char * filePrintText
virtual void SetTitle(const char *title="")
Set graph title.
void about()
online help about Qt&Root Main Application
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
virtual void Reset(Option_t *option="")
Reset.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
virtual void Resize(Option_t *option="")
Recompute canvas parameters following a X11 Resize.
TFrame * GetFrame()
Get frame.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual void SetBorderSize(Short_t bordersize)
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
virtual Double_t Rndm()
Machine independent random number generator.
const char * fileOpenText
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Main Qt&Root Application Window:
void save()
Saving results function:
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
void newDoc()
New incoming functionality documentation.
The most important graphics class in the ROOT system.
void closeEvent(QCloseEvent *ce)
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
R__EXTERN TRandom * gRandom
const char * fileSaveText
TH1F * GetHistogram() const
Returns a pointer to the histogram used to draw the axis Takes into account the two following cases...
virtual void SetGridy(Int_t value=1)
QMimeSourceFactory Q3MimeSourceFactory
Mother of all ROOT objects.
typedef void((*Func_t)())
virtual void SetXTitle(const char *title)
void saveAs()
saving pictures, in different supported formats
A Graph is a graphics object made of two arrays X and Y with npoints each.
virtual void Update()
Update canvas pad buffers.
void Modified(Bool_t flag=1)