[Qt-interest] Controlling when timers run

Sean Harmer sean.harmer at maps-technology.com
Thu Jan 14 23:19:45 CET 2010


Hi,

Glenn Hughes wrote:
> No we've had many issues like this in our program that we're porting
> to Qt, and as a result we need to carefully control when some of our
> timer tasks run. A simple example is an error dialog: something goes
> slightly wrong, and an error dialog is displayed... then timers run
> and try to do things before the user has chosen how to resolve the
> error condition... leading to more errors.
> Or, suppose that we want a single shot timer to close off an undoable
> task, but in the middle of the task a dialog is displayed, so timers
> run and the undo record is closed prematurely.
> 
> Because in our program we have control over all the entry points into
> our executable, we know the calling context... We can determine when
> we have really returned to the main loop, or if we are in an
> intermediate loop.

Ah OK so the problems occur when you enter a local event loop such as 
you get when calling QDialog::exec() and your timers continue to get 
fired from that event loop? Or am I missing something?

Sean



More information about the Qt-interest-old mailing list