在模块中添加QWebEngineWidget
#include <QWebEngineView>
QString path = QApplication::applicationDirPath() + "/smarttest.html";//文件路径
htmlView = new QWebEngineView(this);//创造对象
htmlView->setUrl(QUrl(path));//添加路径
setCentralWidget(htmlView);
在模块中添加QWebEngineWidget
#include <QWebEngineView>
QString path = QApplication::applicationDirPath() + "/smarttest.html";//文件路径
htmlView = new QWebEngineView(this);//创造对象
htmlView->setUrl(QUrl(path));//添加路径
setCentralWidget(htmlView);