QString url="xxxx.png";
QUrl url(url);
QNetworkAccessManager manager;
QEventLoop loop;
QNetworkReply *reply = manager.get(QNetworkRequest(url));
//请求结束并下载完成后,退出子事件循环
connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
//开启子事件循环
loop.exec();
QByteArray jpegData = reply->readAll();
QPixmap pixmap;
pixmap.loadFromData(jpegData);
pixmap.scaled(100, 70, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
meet_record_view_label->setPixmap(pixmap);
meet_record_view_label->setScaledContents(true);
meet_record_view_label->setScaledContents(true);
作用是设置QLabel自动缩放图片,如不设置会导致图片显示不全只看到图片的某个角落