QNetworkAccessManager *manager = new QNetworkAccessManager(); QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(url))); QByteArray responseData; QEventLoop eventLoop; QObject::connect(manager, SIGNAL(finished(QNetworkReply *)), &eventLoop, SLOT(quit())); eventLoop.exec(); responseData = reply->readAll();
QPixmap pix;
pix.loadFromData(responseData);
m_pPushButton->setIcon(QIcon(pix));