更新单线程下载的进度显示

This commit is contained in:
metanoia1989 2020-10-25 20:17:37 +08:00
parent 7eb9ffa28c
commit 9278c04b93
2 changed files with 4 additions and 0 deletions

3
.gitignore vendored
View File

@ -71,3 +71,6 @@ Thumbs.db
*.dll
*.exe
# 编译目录
build/
build-*/

View File

@ -109,6 +109,7 @@ void Widget::singleDownload(const QString& url, const QString& filename)
file.write(reply->readAll());
});
connect(reply, &QNetworkReply::finished, &event, &QEventLoop::quit);
connect(reply, &QNetworkReply::downloadProgress, this, &Widget::download_progress_change);
connect(reply, &QNetworkReply::errorOccurred, [this, reply](QNetworkReply::NetworkError error){
if (error != QNetworkReply::NoError) showError(reply->errorString());
});