Logo ROOT   6.10/09
Reference Guide
TQRootApplication.cxx
Go to the documentation of this file.
1 // @(#)root/qtgsi:$Id$
2 // Author: Denis Bertini, M. Al-Turany 01/11/2000
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 
13 #include "TQRootApplication.h"
14 #include "TSystem.h"
15 #include <stdlib.h>
16 
19 
21 
22 ////////////////////////////////////////////////////////////////////////////////
23 
24 void qMessageOutput( QtMsgType type, const char *msg )
25 {
26  switch ( type ) {
27  case QtDebugMsg:
29  fprintf( stderr, "QtRoot-Debug: \n %s\n", msg );
30  break;
31  case QtWarningMsg:
33  fprintf( stderr, "QtRoot-Warning: \n %s\n", msg );
34  break;
35  case QtFatalMsg:
36  fprintf( stderr, "QtRoot-Fatal: \n %s\n", msg );
37  abort(); // dump core on purpose
38  break;
39  case QtCriticalMsg:
40  fprintf( stderr, "QtRoot-Fatal: \n %s\n", msg );
41  abort(); // dump core on purpose
42  break;
43  }
44 }
45 
46 ////////////////////////////////////////////////////////////////////////////////
47 /// Connect ROOT via Timer call back.
48 
49 TQRootApplication::TQRootApplication(int &argc, char **argv, int poll) :
50  QApplication(argc,argv), fQTimer(0), fRTimer(0)
51 {
52  if (poll == 0) {
53  fQTimer = new QTimer( this );
54  QObject::connect( fQTimer, SIGNAL(timeout()),this, SLOT(Execute()) );
55  fQTimer->start( 20, FALSE );
56  fRTimer = new TTimer(20);
57  fRTimer->Start(20, kFALSE);
58  }
59 
60  // install a msg-handler
62  qInstallMsgHandler( qMessageOutput );
63 }
64 
65 ////////////////////////////////////////////////////////////////////////////////
66 /// dtor
67 
69 {
70 }
71 
72 ////////////////////////////////////////////////////////////////////////////////
73 /// Call the inner loop of ROOT.
74 
76 {
77  gSystem->InnerLoop();
78 }
79 
80 ////////////////////////////////////////////////////////////////////////////////
81 /// Set a Qt-Specific error handler.
82 
84 {
85  gSystem->Exit( 0 );
86 }
void Execute()
Call the inner loop of ROOT.
void qMessageOutput(QtMsgType type, const char *msg)
void Quit()
Set a Qt-Specific error handler.
static Bool_t fgWarning
virtual void Start(Long_t milliSec=-1, Bool_t singleShot=kFALSE)
Starts the timer with a milliSec timeout.
Definition: TTimer.cxx:211
static Bool_t fgDebug
R__EXTERN TSystem * gSystem
Definition: TSystem.h:539
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
virtual void InnerLoop()
Inner event loop.
Definition: TSystem.cxx:407
const Bool_t kFALSE
Definition: RtypesCore.h:92
#define ClassImp(name)
Definition: Rtypes.h:336
int type
Definition: TGX11.cxx:120
TQRootApplication(const TQRootApplication &)
typedef void((*Func_t)())
#define FALSE
virtual void Exit(int code, Bool_t mode=kTRUE)
Exit the application.
Definition: TSystem.cxx:723