VR-Forces 4.2 Class Documentation
List of all members | Classes | Public Member Functions | Private Slots | Private Attributes
DtRecursiveTimer Class Reference

As of Qt 4.4, QTimers no longer allow recursion. More...

Inheritance diagram for DtRecursiveTimer:
Inheritance graph
[legend]

Classes

struct  TimerInfo

Public Member Functions

 DtRecursiveTimer (QObject *parent=0)
 ~DtRecursiveTimer ()
int start (QObject *object, int duration, bool singleShot=false)
 Starts a timer.
void stop (int id)

Private Slots

void onTimerInvoked ()
 Generates the QTimerEvents.

Private Attributes

QMap< QTimer *, TimerInfotimers
int counter

Detailed Description

As of Qt 4.4, QTimers no longer allow recursion.

This class is based on a work-around from TrollTech. It is used by DtTMApplication and DtVrf3DGuiApplication. It operates by posting new QTimerEvents to the QApplication's event queue. To receive the events derived classes must override QObject::timerEvent and check to see if the timerId matches the one returned by start(). If not, it should be passed down to the base class.

Constructor & Destructor Documentation

DtRecursiveTimer::DtRecursiveTimer ( QObject parent = 0)
inline
DtRecursiveTimer::~DtRecursiveTimer ( )
inline

Member Function Documentation

int DtRecursiveTimer::start ( QObject object,
int  duration,
bool  singleShot = false 
)
inline

Starts a timer.

Parameters
objectthe parent object, usually "this"
durationcounter time in miliseconds
singleShotif true the timer will only fire once

References DtRecursiveTimer::TimerInfo::id, DtRecursiveTimer::TimerInfo::object, and DtRecursiveTimer::TimerInfo::singleShot.

void DtRecursiveTimer::stop ( int  id)
inline
void DtRecursiveTimer::onTimerInvoked ( )
inlineprivateslot

Generates the QTimerEvents.

Member Data Documentation

QMap<QTimer *, TimerInfo> DtRecursiveTimer::timers
private
int DtRecursiveTimer::counter
private

The documentation for this class was generated from the following file:

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)