void MainWindow::startDownload() { QUrl newUrl(QUrl(lineEdit->text())); if(!newUrl.isValid()) { QMessageBox::information(this, "error", "invalid url"); return; }
QNetworkRequest networkRequest;
networkRequest.setUrl(newUrl);
QNetworkReply *newReply = netWorkManager->get(networkRequest);
connect(newReply, SIGNAL(finished()), this, SLOT(replyFinished())); connect(newReply, SIGNAL(readyRead()), this, SLOT(readyReadData())); connect(newReply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(imageDownloadProgress(qint64, qint64))); }
|