[Qt-interest] Controlling when timers run

Andreas Pakulat apaku at gmx.de
Sun Jan 17 19:32:09 CET 2010


On 17.01.10 11:15:07, william.crocker at analog.com wrote:
> 
> >> The problem here is that many apparently innocuous activities
> >> process events as a side effect. I believe the following are
> >> examples:
> >>
> >>     void   QStatusBar::showMessage(...)
> >>     void QProgressBar:: ...
> >
> > Uhm, huh? QStatusBar::showMessage() doesn't process any events. All it does
> > is schedule a paint event and a timer event. And QProgressBar has no
> > showMessage() function.
> 
> Yes. I was wrong. I'm getting old. Excuse me.
> 
> My problem with QStatusBar::showMessage was that the message would
> not appear unless you returned to the event loop or explicitly called
> ::processEvents().  In my case, calling ::processEvents allowed other
> queued activities to proceed when I was not ready.

Of course you can't change the UI on the display without processing the
necessary paint events. However processEvents can be called with flags
so that only particular events are processed.

> And I meant QProgressDialog, not QProgressBar.
> Use of QProgressDialog has embedded calls to ::processEvents with
> the same problem.

Only for modal ones, so you could make your dialog non-modal ;)

Andreas

-- 
You shall be rewarded for a dastardly deed.



More information about the Qt-interest-old mailing list