Man QEventLoop and man QxtSignalWait can help fix that.
Attach a file by drag & drop or click to upload