auto future = std::async(std::launch::async, [this] { /*耗时操作*/});
while (true) {
auto status = future.wait_for(std::chrono::seconds(3));
if (status == std::future_status::timeout || GetLastError() == ERROR_TIMEOUT) {
QApplication::processEvents();
}
if (status == std::future_status::ready) {
break;
}
}
QT主线程等待执行耗时操作,同时不卡死界面
于 2023-11-03 16:11:49 首次发布