A detailed introduction to the Qt Webkit Module

Source: Internet
Author: User

AboutQt Webkit ModuleThe detailed introduction is the content to be introduced in this article, mainly to learnWebkit,QtWebkit ModuleProvidesQtUsing the web browser engine inQTIt is easy to use content on the World Wide Web in applications, and the control of its webpage content can also be implemented through native controls.

QtWebkitSupports rendering HTML, XHTML, and SVG documents, and uses CSS layout to runJavaScript.

The direct bridging technology in the JavaScript runtime environment and Qt object model enables custom QObject to be used in JavaScript code. The integration with Qt network module allows web pages to be downloaded from servers, local file systems, and even qt resource systems.

To provide rendering features, you can use the contenteditable attribute of the HTML elementHTML documentIt can be edited by users.

QtWebkit is based on open-source WebKit engine. For more information, go to http://www.webkit.org.

To use the class in the Qtwebkit module, add the # include <QtWebKit> in the header file and add the QT ++ = webkit statement to the pro file of the project.

QtWebkit high-level architecture:

QWebView is mainly used to view web pages. A QWebView instance has a QWebPage.

QWebPage can access the document structure of this page. It mainly describes the structure of the document such as Frames, he navigation history, and the undo/redo stack of the edited content.

HTML documentCan be nested into a frame in a frameset. An independent frame of HTML is displayed through the QWebFrame class. This class contains the bridge to the JS window object and the QPainter used for refreshing. Each QWebPage has a QWebFrame as its main frame. A main frame can contain multiple child frames.

Each Frame has its own JavaScript Context. QWebFrame: addToJavaScriptWindowObject () allows objects in Qt C ++ to be accessed from JavaScript Functions. QWebFrame: evaluateJavaScript () allows you to directly run JavaScript code in C ++ code.

Independent elements in an HTML document can be accessed through the DOM JavaScript interface on the same page. The corresponding class is QWebElement. You can use the CSS selector to obtain the QWebElement object through the QWebFrame's findAllElements () and findFirstElement () functions.

QWebSetting provides common browser attributes and configuration of various settings. For example, JavaScript enabled and plugin enabled. The default settings show the default configurations of all QWebPage instances. Individual attributes can be set through setting on this page. Global Setting uses QWebSetting: globalSettings (), and the settings of a page uses QWebPage: settings ().

QWebHsitory is mainly used to store access history records of QWebPage and provides support for navigation to related pages.

QWebHistoryInterface provides an interface for Implementing Access History connections.

Note: Only Netscape plugin is supported on the desktop system.

SinceWebKitSupports the Netscape Plugin API. qt applications can display common plugins available on the current platform. To make plugin support available, you must install the corresponding plugin and set the QWebSetting: PluginEnabled of the current application to available.

QNetworkAccessManager is an asynchronous API that can send and receive data. It can be viewed as the post/put/get/head API. It also provides support for cookies and sessions.

Summary: AboutQt Webkit ModuleThe details are described in detail. I hope this article will help you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.