I’m importing a portion of existing code into my Qt app and noticed a sleep function in there. I see that this type of function has no place in event programming. What should I do instead?
UPDATE: After thought and feedback I would say the answer is: call sleep outside the GUI main thread only and if you need to wait in the GUI thread use processEvents() or an event loop, this will prevent the GUI from freezing.
It is not necessary to break down the events at all. All I needed to do was to call
QApplication::processEvents()wheresleep()was and this prevents the GUI from freezing.