How about:
Qt Code:
  1. MyDialog d;
  2. QTimer::singleShot(0, &d, SLOT(doTimeConsumingTask()));
  3. d.exec();
To copy to clipboard, switch view to plain text mode 

This should execute the slot immediately when d.exec() is called (provided that the event will not make it to a wrong queue). The drawback is that you will block the event loop if you do everything in the slot at once. So either do it the way J-P mentioned or split the task into subtasks, put each in a separate slot and as the last line of each slot start a timer that will trigger the next slot.