我的主页

快递查询 :http://m.kuaidi100.com     爱快递查询 :http://www.aikuaidi.cn/              

http://www.qtcn.org/bbs/u/168050  [收藏] [复制]

w642833823

  • 10

    关注

  • 68

    粉丝

  • 42

    访客

  • 等级:新手上路
  • 总积分:43
  • 保密,2011-12-07

最后登录:2024-04-27

更多资料

日志

收集QLabel显示网页

2022-09-25 19:20
文章来源:
将QQ中的图文聊天内容显示到Qt界面
  1. #include <QMimeData>
    #include <QClipboard>
    #include <QDebug>
    Widget::Widget(QWidget *parent)
        : QWidget(parent)
        , ui(new Ui::Widget)
    {
        ui->setupUi(this);
    }

    Widget::~Widget()
    {
        delete ui;
    }


    void Widget::on_pushButton_clicked()
    {
        const QClipboard *clipboard = QApplication::clipboard();
           const QMimeData *mimeData = clipboard->mimeData();
            if (mimeData->hasHtml()) {
                    QString html = mimeData->html();
                    html.replace(QString("\\"), QString("/"));
                   html.remove("file:///");
                    ui->label->setText(html);
                   qDebug() <<"html: " <<  html;
                   ui->label->setTextFormat(Qt::RichText);
                   }
    }


分类:QT|回复:0|浏览:472|全站可见|转载
 

Powered by phpwind v8.7 Certificate Copyright Time now is:04-27 21:16
©2005-2016 QTCN开发网 版权所有 Gzip disabled