void MainWindow::on_ParceButton_clicked()
{
ui->ParceButton->setEnabled(false);
int thr = ui->lineEdit4->text().toInt();
ifstream inp_tmp("AllTempLinks.txt");
runnedth=0;
QNetworkAccessManager *nmanager = new QNetworkAccessManager;
connect(nmanager, SIGNAL(finished(QNetworkReply*)), this, SLOT(FinishedSlot(QNetworkReply*)));
string link;
while(getline(inp_tmp,link))
{
QUrl req = QUrl(QString::fromStdString(link));
while(runnedth >= thr)
{
QApplication::processEvents();
}
QNetworkReply* reply = nmanager->get(QNetworkRequest(req));
ui->label_6->setNum(totalglinks);
}
inp_tmp.close();
ui->ParceButton->setEnabled(true);
}
所有请求都成功结束,但是 ui->label_6->setNum(totalglinks); 不工作。当我的函数被调用时,ParceButton 仍然处于活动状态。