Qt WebEngine Widgets C++ Classes
提供用于在基于QWidget 的应用程序中渲染网页内容的 C++ 类。更多
类
用于查看和编辑网络文档的小工具 |
详细说明
Qt WebEngine Widgets 模块提供了一个网络浏览器引擎以及用于渲染网络内容并与之交互的 C++ 类。
要使用 qmake 联编模块,请在 qmake .pro 文件中添加以下 QT 变量:
QT += webenginewidgets
使用 CMake 生成时,可使用find_package()
命令在 Qt6 软件包中找到所需的模块组件,然后使用target_link_libraries()
链接模块:
find_package(Qt6 REQUIRED COMPONENTS WebEngineWidgets) target_link_libraries(target PRIVATE Qt6::WebEngineWidgets)
加载和显示 HTML 页面所需的最少代码量只需实现QWebEngineView
类。
#include <QApplication> #include <QWebEngineView> int main(int argc, char *argv[]) { QApplication app(argc, argv); QWebEngineView view; view.load(QUrl("https://qt-project.org/")); view.resize(1024, 750); view.show(); return app.exec(); }
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.