Hybrid application with Qt: Difference between revisions
AutoSpider (talk | contribs) (Add "cleanup" tag) |
AutoSpider (talk | contribs) (Convert ExpressionEngine section headers) |
||
Line 1: | Line 1: | ||
{{Cleanup | reason=Auto-imported from ExpressionEngine.}} | {{Cleanup | reason=Auto-imported from ExpressionEngine.}} | ||
= Qt Features for Web and Native Api interaction for Application Development** = | |||
With the Qt WebKit Integration and the QtNetwork module, you have all the tools that you need to | With the Qt WebKit Integration and the QtNetwork module, you have all the tools that you need to | ||
create your own hybrid applications by mixing JavaScript, style sheets, web content and Qt | create your own hybrid applications by mixing JavaScript, style sheets, web content and Qt |
Revision as of 16:01, 5 March 2015
This article may require cleanup to meet the Qt Wiki's quality standards. Reason: Auto-imported from ExpressionEngine. Please improve this article if you can. Remove the {{cleanup}} tag and add this page to Updated pages list after it's clean. |
Qt Features for Web and Native Api interaction for Application Development**
With the Qt WebKit Integration and the QtNetwork module, you have all the tools that you need to create your own hybrid applications by mixing JavaScript, style sheets, web content and Qt components freely. Combined with the QtXmlPatterns module, you can download, transform and query XML and present it in a hybrid web environment.
Features of the Qt WebKit Integration One of the key components when mixing web and native applications is the web contents rendering engine – QtWebKit. This module makes it easy to integrate the wide-spread WebKit engine into your applications. The integration includes triggering JavaScript from C+, as well as integrating C+ objects into a web page and interacting with those objects through JavaScript. The WebKit engine can be seen as a fully fledged web browser engine. The highlights of this engine are its modern rendering features
Interacting With Embedded Qt Objects :
There are two ways to embed Qt objects into a web page illustrated using the QWebView widget. You can either add your objects to the JavaScript context of a page, or you can create a plugin that makes it possible to place Qt widgets inside a web page using the object tag.
The latter is an easy way to start creating a hybrid application: simply put your widgets inside a web page. When the widgets are in the page, their public slots will be exposed to JavaScript functions of the page as ordinary functions.
To add a widget to a page, you need to tell your QWebPage object that the widget is available. This is done by subclassing the QWebPluginFactory class and reimplementing the methods plugins and create. The plugins method informs the web page of which plugins it makes available, while the create method creates widgets on demand.
From the HTML making up the web page in question, the widgets are created using the object tag. For instance, the following tag will attempt to create an instance of an application/x-qt-colorlabel widget.
TODO: