C++ (Qt)QEventLoop q;QTimer tT; tT.setSingleShot(true);connect(&tT, SIGNAL(timeout()), &q, SLOT(quit()));tT.start(5000); // 5s timeoutq.exec();