You are opening the QMessageBox as a modal dialog. It will take the focus for the entire application until it is closed. That seems to be exactly what you are asking for.
If you want a modeless dialog call show() instead of exec() and be to respond to button clicks asynchronously in connected slots.
Bookmarks