[Qt-interest] Controlling when timers run

clinton at elemtech.com clinton at elemtech.com
Fri Jan 15 00:35:14 CET 2010


Can you just use your own QEventLoop instead of QApplication::exec() ?
Then you can do something like

QEventLoop eventLoop;
while(eventloop.isRunning())
{
  eventloop.processEvents(QEventLoop::WaitForMoreEvents);
  eventloop.processEvents();
  MySpecialStuff();
}

QApplication::exec just uses a QEventLoop to do the work.

The docs for QEventLoop::exec say "More sophisticated idle processing schemes can be achieved using processEvents()."

Clint

----- Glenn Hughes <ghughes02138 at gmail.com> wrote:
> Hi Sean, yes, that helps, but I'd like a way of doing this so that the
> programmer does not need to remember to do the
> TimerManager::instance()->stopTimers(); /
> TimerManager::instance()->startTimers(); around each call to exec. The
> more stuff like that the programmer needs to do the less likely they
> will remember to do them, and the more likely bugs will sneak in.
> 
> Thanks!
> Glenn
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list