可用于在应用中实现网页渲染功能。该项目是基于 KParts 技术、使用 KJS 支持 JavaScript 的 Web 渲染引擎,通过创建 KHTMLPart 实例并嵌入应用来控制内容显示。【此简介由AI生成】
| Files | Last commit | Last update |
|---|---|---|
| 4 years ago | ||
| 3 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago | ||
| 4 years ago |
KHTML
HTML rendering engine
Introduction
KHTML is a web rendering engine, based on the KParts technology and using KJS for JavaScript support.
Usage
If you are using CMake, you need to have
find_package(KF5KHtml NO_MODULE)
(or similar) in your CMakeLists.txt file, and you need to link to KF5::KHtml.
To use KHTML in your application, create an instance of KHTMLPart, embed it in your application like any other KPart, and call methods to control what it displays:
QUrl url("https://www.kde.org");
KHTMLPart *w = new KHTMLPart();
w->openUrl(url);
w->view()->resize(500, 400);
w->show();
Alternatives
Note that using KHTMLPart may introduce security vulnerabilities and unnecessary bloat to your application. Qt's text widgets are rich-text capable, and will interpret a limited subset of HTML.
Another option is to use KDEWebKit, WebKit is a fork of KHTML with substantial industry support.