4 Star 3 Fork 6

YanZhao/GoogleMapDownloader

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
httpgetter.cpp 934 Bytes
一键复制 编辑 原始数据 按行查看 历史
YanZhao 提交于 2014-05-09 17:28 +08:00 . 项目开始使用Git进行版本管理.
#include <QtCore>
#include <QtNetwork>
#include "httpgetter.h"
#include <QImage>
#include <iostream>
HttpGetter::HttpGetter(QObject *parent)
: QObject(parent)
{
}
void HttpGetter::httpFinished()
{
QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
if (reply->error()) {
std::cerr << "Download failed: " << std::endl;
}
reply->deleteLater();
reply = 0;
emit dataDownloaded();
}
void HttpGetter::httpReadyRead()
{
imgData += reply->readAll();
}
QByteArray HttpGetter::getImgData() const
{
return imgData;
}
void HttpGetter::setImgData(const QByteArray &value)
{
imgData = value;
}
void HttpGetter::startRequest(const QUrl &url)
{
reply = qnam.get(QNetworkRequest(url));
connect(reply, SIGNAL(finished()),
this, SLOT(httpFinished()));
connect(reply, SIGNAL(readyRead()),
this, SLOT(httpReadyRead()));
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/whuhenry/GoogleMapDownloader.git
git@gitee.com:whuhenry/GoogleMapDownloader.git
whuhenry
GoogleMapDownloader
GoogleMapDownloader
master

搜索帮助