I have a method which is called from both QThreads and the main thread. this method can sometimes take a long time to do its computations in a loop so I put
Neither, processEvent() should be calld only when you have actual pending events to process.
You may find this useful : How to make Qt work when main thread is busy?