Qt-QWebEngineView显示百度网页

版本:Qt5.14

1、.pro

QT += webenginewidgets

 

2、头文件

#include <QWebEngineView>

 

3、代码

int main(int argc, char *argv[]){
    QApplication a(argc, argv);

    QWebEngineView *view = new QWebEngineView();
    view->load(QUrl("https://www.baidu.com/"));
    view->show();

    return a.exec();
}

 

 

PS:

如果想实现通信则用QWebChannel :https://www.cnblogs.com/sigma0/p/7346727.html

posted @ 2021-12-04 14:15  朱小勇  阅读(474)  评论(0编辑  收藏  举报