VR-Forces 4.0.4 Class Documentation
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]

List of all members.

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]

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 ( ) [inline, private, slot]

Generates the QTimerEvents.


Member Data Documentation

QMap<QTimer *, TimerInfo> DtRecursiveTimer::timers [private]

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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)