[Qt-interest] QEventLoop and QEvents

Frank Hemer frank at hemer.org
Mon Feb 22 16:43:04 CET 2010


On Monday 22 February 2010 16:25:17 Eric Clark wrote:

> > An eventloop is _PROCESSING_ the events, its not a storage class.
> >
> > Use a QQueue to store the event copies and their receiver.
> > And post them later using QApplication::postEvent.
>
> I thought that an event loop used a queue to store the events until
> processEvents was called on it... Is this incorrect? If I never call exec
> on the event loop, will it not store the events that I post to it until I
> either call exec or processEvents?

Its definitely not made for this usecase - however I didn't check the sources 
whether it might work or not.
Note that QEventLoop will not only receive your events ...

If you simply want to store events and post them delayed its much easier to 
implement it using a QQueue (I successfully did that a while ago).
And you're independant of the qt internals of QEventLoop ...

Frank



More information about the Qt-interest-old mailing list