[Qt-interest] How Qt Event loop and Qthread mechanism works!

Santhosh Y santhosh at softjin.com
Sat Jun 20 14:00:32 CEST 2009


Hi,

This mail is regarding the how the event loop will work in a GUI Thread 
(Main thread) and in the Worker Thread.

Following is my understanding:

   1. For a GUI project we create a QApplication and we say exec() to
      start a event loop. This event loop maintains the list of event
      and dispatches to the receivers depending on the priority.
   2. When we create a thread by subclassing QThread , we can say exec()
      on thread to start its own event loop. (OR) We can emit signals in
      this subclass and we can catch it in the GUI thread for acting to
      the call.
   3. One can manually post events to any object in any thread at any
      time using the thread-safe function QCoreApplication::postEvent
      <qcoreapplication.html#postEvent>(). The events will automatically
      be dispatched by the event loop of the thread where the object was
      created.

Is my understanding correct?  Can anybody suggest me how can I better 
understand the  Qt event loop structure.
How the Qt infrastructure for this event loop works?

Any help is appreciated.

Regards
Santhosh

-- 

-- 
----------------------------------------------------
Y Santhosh Kumar
Senior Software Engineer
SoftJin Technologies Private Limited
Unit No. 102, Mobius Tower,
I Floor, SJR I - Park,
EPIP, White Field,
Bangalore - 560066, India
U : www.softjin.com
E : santhosh at softjin.com
T : +91-80-41779999
M : +91-9740535265
----------------------------------------------------



Business Disclaimer
____________________________________________________________
This e-mail message and any files transmitted with it are intended solely
for  the use  of the  individual or entity  to which they  are  addressed. It
may  contain confidential,  proprietary or legally  privileged  information.
If  you  are  not  the  intended recipient please be advised that you have
received  this  message in error and any use is strictly prohibited. Please
immediately  delete it  and all copies of it from your system, destroy any
hard  copies  of  it and  notify  the  sender  by return mail. You must not,
directly or indirectly, use,  disclose,  distribute, print, or copy any part of
this message if you are not the intended recipient.
___________________________________________________________





More information about the Qt-interest-old mailing list