我的代码如下:
void WebView::downloadRequestedSlot(const QNetworkRequest &req)
{
downFileHttp = new QHttp(this);
connect(downFileHttp, SIGNAL(requestFinished(int, bool)), \
this, SLOT(requestFinishedSlot(int, bool)));
downFileHttp->setHost(req.url().host(), req.url().port());
index = downFileHttp->get(req.url().path(), downFile);
downFileHttp->close();
}
void WebView::requestFinishedSlot(int requestId, bool error)
{
if(index == requestId) {
downFile->close();
downFileHttp->close();
}
}
下载文本文件没有问题,但却下载二进制文件如图片却不能下载下来,搞不清楚怎么回事,查了大批的代码,都实践了,都下载不下来,无语。。。。等待大家的回复。