我每 X 秒建立一次连接。但如果网络带宽超载,定时器会在 QNetworkAccessManager 发送完成信号和应用程序崩溃之前触发。
主窗口::构造:
pTimer = new QTimer(this);
connect(pTimer, SIGNAL(timeout()), this, SLOT(connect()));
pTimer->start(5000);
主窗口::连接()
pNetworkManager = new QNetworkAccessManager(this);
connect(pNetworkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(result(QNetworkReply*)));
pNetworkManager->get(QNetworkRequest(url));
MainWindow::result(QNetworkReply *reply) 处理响应
如何在计时器再次触发之前检查 QNetworkAccessManager 是否已完成?