TQtTimer.cxx

Go to the documentation of this file.
00001 // @(#)root/qt:$Id: TQtTimer.cxx 32141 2010-01-28 16:42:30Z bellenot $
00002 // Author: Valeri Fine   23/01/2003
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
00006  * Copyright (C) 2003 by Valeri Fine.                                    *
00007  * All rights reserved.                                                  *
00008  *                                                                       *
00009  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00010  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00011  *************************************************************************/
00012 
00013 #include <qapplication.h>
00014 #include "TQtTimer.h"
00015 #include "TSystem.h"
00016 
00017 ////////////////////////////////////////////////////////////////////////////////
00018 //
00019 // TQtTimer is a singelton singleshot QTimer to awake the ROOT event loop from Qt event loop
00020 //
00021 ////////////////////////////////////////////////////////////////////////////////
00022 
00023 ClassImp(TQtTimer)
00024 
00025 TQtTimer *TQtTimer::fgQTimer=0;
00026 //______________________________________________________________________________
00027 void TQtTimer::AwakeRootEvent(){
00028      // proceess the ROOT events inside of Qt event loop
00029      gSystem->DispatchOneEvent(kFALSE);
00030      start(300);
00031 }
00032 //______________________________________________________________________________
00033 TQtTimer * TQtTimer::Create(QObject *parent)
00034 {
00035    // Create a singelton object TQtTimer
00036    if (!fgQTimer) {
00037       fgQTimer = new  TQtTimer(parent);
00038       fgQTimer->setSingleShot(true);
00039       connect(fgQTimer,SIGNAL(timeout()),fgQTimer,SLOT(AwakeRootEvent()) );
00040    }
00041    return fgQTimer;
00042 }
00043 
00044 //______________________________________________________________________________
00045 TQtTimer *TQtTimer::QtTimer()
00046 {
00047    // Return the singelton TQtTimer object
00048    return fgQTimer;
00049 }
00050 

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