Mainloop QEventloop and Reposting events (help)
-
All,
i read about a method of making something async sync, by using an QEventloop...
I don't want to start the discussion of whether this is the way to go or not. But i want to talk about the possibilities i have to prevent certain events to be processed.
So what i want to reach is that within the eventloop i only accept the events (signals etc...) that i need, and somehow repost all other events back on the loop (for example the mainloop). Is this possible?
For example:
I have a mainloop running, and i started a worker thread... on a certain moment i want to do a third thing, which is normally async, but using the QEventloop method, i can make it sync.
Currently the signals triggered by my worker thread are handled (eventhough i used queued connections) as they are being processed by the QEventloop i started to process the third thing.
I know that i can filter certain events by setting an event filter. But i can only either process (accept them) or block them (in which case the event is lost)....
So the question: can i put a filter which does not block the events, but reposts them again ... after i removed then the filter, the events will get processed eventually.Is this clear? And is it possible?
THANKS!
-
Hi,
More or less clear, from the top of my head I would say no. You will probably have to look at QAbstractEventDispatcher
-
Hiii
Do you want to post your event?
May be following link could be helpful to youhttp://www.qtcentre.org/threads/17696-postEvent-and-multithreading