ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Qt加载网页图标

2021-07-22 11:31:48  阅读:13  来源: 互联网

标签:responseData Qt eventLoop QNetworkReply pix manager reply 图标 加载


 

 

   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));

 

标签:responseData,Qt,eventLoop,QNetworkReply,pix,manager,reply,图标,加载
来源: https://www.cnblogs.com/tingtaishou/p/15043281.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有