// @(#)root/qt:$Id$
// Author: Valeri Fine   23/01/2003

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

#include <qapplication.h>
#include "TQtTimer.h"
#include "TSystem.h"

////////////////////////////////////////////////////////////////////////////////
//
// TQtTimer is a singelton singleshot QTimer to awake the ROOT event loop from Qt event loop
//
////////////////////////////////////////////////////////////////////////////////

ClassImp(TQtTimer)

TQtTimer *TQtTimer::fgQTimer=0;
//______________________________________________________________________________
void TQtTimer::AwakeRootEvent(){
     // proceess the ROOT events inside of Qt event loop
     gSystem->DispatchOneEvent(kFALSE);
     start(5);
}
//______________________________________________________________________________
TQtTimer * TQtTimer::Create(QObject *parent)
{
   // Create a singelton object TQtTimer
   if (!fgQTimer) {
      fgQTimer = new  TQtTimer(parent);
      fgQTimer->setSingleShot(true);
      connect(fgQTimer,SIGNAL(timeout()),fgQTimer,SLOT(AwakeRootEvent()) );
   }
   return fgQTimer;
}

//______________________________________________________________________________
TQtTimer *TQtTimer::QtTimer()
{
   // Return the singelton TQtTimer object
   return fgQTimer;
}

 TQtTimer.cxx:1
 TQtTimer.cxx:2
 TQtTimer.cxx:3
 TQtTimer.cxx:4
 TQtTimer.cxx:5
 TQtTimer.cxx:6
 TQtTimer.cxx:7
 TQtTimer.cxx:8
 TQtTimer.cxx:9
 TQtTimer.cxx:10
 TQtTimer.cxx:11
 TQtTimer.cxx:12
 TQtTimer.cxx:13
 TQtTimer.cxx:14
 TQtTimer.cxx:15
 TQtTimer.cxx:16
 TQtTimer.cxx:17
 TQtTimer.cxx:18
 TQtTimer.cxx:19
 TQtTimer.cxx:20
 TQtTimer.cxx:21
 TQtTimer.cxx:22
 TQtTimer.cxx:23
 TQtTimer.cxx:24
 TQtTimer.cxx:25
 TQtTimer.cxx:26
 TQtTimer.cxx:27
 TQtTimer.cxx:28
 TQtTimer.cxx:29
 TQtTimer.cxx:30
 TQtTimer.cxx:31
 TQtTimer.cxx:32
 TQtTimer.cxx:33
 TQtTimer.cxx:34
 TQtTimer.cxx:35
 TQtTimer.cxx:36
 TQtTimer.cxx:37
 TQtTimer.cxx:38
 TQtTimer.cxx:39
 TQtTimer.cxx:40
 TQtTimer.cxx:41
 TQtTimer.cxx:42
 TQtTimer.cxx:43
 TQtTimer.cxx:44
 TQtTimer.cxx:45
 TQtTimer.cxx:46
 TQtTimer.cxx:47
 TQtTimer.cxx:48
 TQtTimer.cxx:49
 TQtTimer.cxx:50