Solved: I used:
That is the solution I was about to suggest. Your original code shows a misunderstanding of how QTimer works. You do not start a QTimer and then keep checking it until it goes to zero. Instead, you connect a slot to the QTimer's timeout() signal. The timer will count down by itself, and fire the signal when it reaches zero. In the meantime, your application goes about doing whatever it needs to do and reacts only when the slot gets called.

(This is like almost every other GUI widget in Qt - you create it, connect your slots to its signals, and then your app runs in the event loop until one of those signals gets emitted and your slot called).

A QTimer as a member variable in a class can be reused as many times as you want. A single-shot timer works once, so you need to set it up every time you want to use it.