// @(#)root/qtgsi:$Name:  $:$Id: TQRootApplication.cxx,v 1.4 2006/04/13 09:46:06 brun Exp $
// Author: Denis Bertini, M. Al-Turany  01/11/2000

/*************************************************************************
 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/


#include "TQRootApplication.h"
#include "TSystem.h"

bool TQRootApplication::fgDebug=kFALSE;
bool TQRootApplication::fgWarning=kFALSE;

ClassImp(TQRootApplication)

//______________________________________________________________________________
void qMessageOutput( QtMsgType type, const char *msg )
{
   switch ( type ) {
      case QtDebugMsg:
         if(TQRootApplication::fgDebug)
            fprintf( stderr, "QtRoot-Debug: \n %s\n", msg );
         break;
      case QtWarningMsg:
         if(TQRootApplication::fgWarning)
            fprintf( stderr, "QtRoot-Warning: \n %s\n", msg );
         break;
      case QtFatalMsg:
         fprintf( stderr, "QtRoot-Fatal: \n %s\n", msg );
         abort();         // dump core on purpose
   }
}

//______________________________________________________________________________
TQRootApplication::TQRootApplication(int argc, char **argv, int poll):QApplication(argc,argv)
{
   // Connect ROOT via Timer call back.

   if (poll == 0) {
      QTimer *fQTimer= new QTimer( this );
      QObject::connect( fQTimer, SIGNAL(timeout()),this, SLOT(Execute()) );
      fQTimer->start( 20, FALSE );
      fRTimer = new TTimer(20);
      fRTimer->Start(20, kFALSE);
   }

   // install a msg-handler
   fgWarning=fgDebug=kFALSE;
   qInstallMsgHandler( qMessageOutput );
}

//______________________________________________________________________________
TQRootApplication::~TQRootApplication()
{
   // dtor
}

//______________________________________________________________________________
void TQRootApplication::Execute()
{
   // Call the inner loop of ROOT.

   gSystem->InnerLoop();
}

//______________________________________________________________________________
void TQRootApplication::Quit()
{
   // Set a Qt-Specific error handler.

   gSystem->Exit( 0 );
}


ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.