如果出现url重定向,加下面这个,QT5.6之后支持
QNetworkRequest request; request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
5.6之前可以用下面方法获取到重定向之后的地址
QNetworkReply reply;
QUrl url;
QVariant redirectUrl = reply.attribute(QNetworkRequest::RedirectionTargetAttribute);
if (redirectUrl.isValid()) {
url = redirectUrl.toUrl();