Hybrid application with Qt: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
=Qt Features for Web and Native Api interaction for Application Development**=
h1. 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 <br /> create your own hybrid applications by mixing JavaScript, style sheets, web content and Qt <br /> components freely. Combined with the QtXmlPatterns module, you can download, transform and <br /> query <span class="caps">XML</span> and present it in a hybrid web environment.
With the Qt WebKit Integration and the QtNetwork module, you have all the tools that you need to<br />create your own hybrid applications by mixing JavaScript, style sheets, web content and Qt<br />components freely. Combined with the QtXmlPatterns module, you can download, transform and<br />query XML and present it in a hybrid web environment.


Features of the Qt WebKit Integration <br /> One of the key components when mixing web and native applications is the web contents rendering <br /> engine – QtWebKit. This module makes it easy to integrate the wide-spread WebKit engine into <br /> your applications. The integration includes triggering JavaScript from C++, as well as integrating <br /> C++ objects into a web page and interacting with those objects through JavaScript. <br /> The WebKit engine can be seen as a fully fledged web browser engine. The highlights of this engine <br /> are its modern rendering features
Features of the Qt WebKit Integration<br />One of the key components when mixing web and native applications is the web contents rendering<br />engine – QtWebKit. This module makes it easy to integrate the wide-spread WebKit engine into<br />your applications. The integration includes triggering JavaScript from C+'', as well as integrating<br />C''+ objects into a web page and interacting with those objects through JavaScript.<br />The WebKit engine can be seen as a fully fledged web browser engine. The highlights of this engine<br />are its modern rendering features


Interacting With Embedded Qt Objects :
Interacting With Embedded Qt Objects :


There are two ways to embed Qt objects into a web page illustrated using the QWebView widget. <br /> You can either add your objects to the JavaScript context of a page, or you can create a plugin that <br /> makes it possible to place Qt widgets inside a web page using the object tag.
There are two ways to embed Qt objects into a web page illustrated using the QWebView widget.<br />You can either add your objects to the JavaScript context of a page, or you can create a plugin that<br />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 <br /> page. When the widgets are in the page, their public slots will be exposed to JavaScript functions of <br /> the page as ordinary functions.
The latter is an easy way to start creating a hybrid application: simply put your widgets inside a web<br />page. When the widgets are in the page, their public slots will be exposed to JavaScript functions of<br />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 <br /> done by subclassing the QWebPluginFactory class and reimplementing the methods plugins and <br /> create. The plugins method informs the web page of which plugins it makes available, while the <br /> create method creates widgets on demand.
To add a widget to a page, you need to tell your QWebPage object that the widget is available. This is<br />done by subclassing the QWebPluginFactory class and reimplementing the methods plugins and<br />create. The plugins method informs the web page of which plugins it makes available, while the<br />create method creates widgets on demand.


From the <span class="caps">HTML</span> making up the web page in question, the widgets are created using the object tag. <br /> For instance, the following tag will attempt to create an instance of an application/x-qt-colorlabel<br /> widget.
From the HTML making up the web page in question, the widgets are created using the object tag.<br />For instance, the following tag will attempt to create an instance of an application/x-qt-colorlabel<br />widget.


<span class="caps">TODO</span>:
TODO:

Revision as of 06:13, 24 February 2015

h1. 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: