tags:

views:

44

answers:

1

In QApplication if we call exec() then does a new process / thread start?

+2  A: 

No, calling exec will:

Enters the main event loop and waits until exit() is called, then returns the value that was set to exit() (which is 0 if exit() is called via quit()).

It is necessary to call this function to start event handling. The main event loop receives events from the window system and dispatches these to the application widgets.

Idan K
I want to execute qapplication.exec() in a separate thread and some other processing in second thread. If i directly use exec() then my main thread never gets called till i call exit() and it makes no sense as upon exit my exe shall close. can u provide some direction in this
ruby
`QApplication::exec()` must be called from the main thread. If you want to do work on another thread, by all means create a `QThread`. Use signals/slots to communicate between the main thread (UI) and the `QThread`.
Idan K