4
\contentspage All Qt Modules
8
\ingroup technology-apis
10
\brief The QtWebKit module provides a web browser engine as well as
11
classes to render and interact with web content.
13
QtWebKit provides a Web browser engine that makes it easy to embed content
14
from the World Wide Web into your Qt application. At the same time Web
15
content can be enhanced with native controls.
17
QtWebKit provides facilities for rendering of HyperText Markup Language
18
(HTML), Extensible HyperText Markup Language (XHTML) and Scalable Vector
19
Graphics (SVG) documents, styled using Cascading Style Sheets (CSS) and
20
scripted with JavaScript.
22
A bridge between the JavaScript execution environment and the Qt object
23
model makes it possible for custom QObjects to be scripted. For detailed
24
documentation see \l{The QtWebkit Bridge}.
25
Integration with the Qt networking module enables Web pages to be transparently loaded
26
from Web servers, the local file system or even the Qt resource system.
28
In addition to providing pure rendering features, HTML documents can be
29
made fully editable to the user through the use of the \c{contenteditable}
30
attribute on HTML elements.
32
QtWebKit has been enhanced to become more attractive on the mobile front as well.
33
For more information see \l{QtWebKit Goes Mobile}.
35
QtWebKit is based on the Open Source WebKit engine. More information about
36
WebKit itself can be found on the \l{WebKit Open Source Project} Web site.
38
\section1 Including In Your Project
40
To include the definitions of the module's classes, use the
43
\snippet webkitsnippets/qtwebkit_build_snippet.qdoc 1
45
To link against the module, add this line to your \l qmake \c
48
\snippet webkitsnippets/qtwebkit_build_snippet.qdoc 0
52
\note Building the QtWebKit module with debugging symbols is problematic
53
on many platforms due to the size of the WebKit engine. We recommend
54
building the module only in release mode for embedded platforms.
55
Currently QtWebKit will always be compiled without debugging symbols
56
when using gcc. Take a look at the last lines of
57
\c{src/3rdparty/webkit/Source/WebCore/WebCore.pro} if you need to change this.
59
\note Web site icons, also known as "FavIcons", are currently not supported
60
on Windows. We plan to address this in a future release.
62
\note WebKit has certain minimum requirements that must be met on
63
Embedded Linux systems. See the \l{Qt for Embedded Linux Requirements}
64
document for more information.
66
\section1 Architecture
68
The easiest way to render content is through the QWebView class. As a
69
widget it can be embedded into your forms or a graphics view, and it
70
provides convenience functions for downloading and rendering web sites.
72
\snippet webkitsnippets/simple/main.cpp Using QWebView
74
QWebView is used to view Web pages. An instance of QWebView has one
75
QWebPage. QWebPage provides access to the document structure in a page,
76
describing features such as frames, the navigation history, and the
77
undo/redo stack for editable content.
79
HTML documents can be nested using frames in a frameset. An individual
80
frame in HTML is represented using the QWebFrame class. This class includes the
81
bridge to the JavaScript window object and can be painted using QPainter.
82
Each QWebPage has one QWebFrame object as its main frame, and the main frame
83
may contain many child frames.
85
Individual elements of an HTML document can be accessed via DOM JavaScript
86
interfaces from within a web page. The equivalent of this API in QtWebKit
87
is represented by QWebElement. QWebElement objects are obtained using QWebFrame's
88
\l{QWebFrame::}{findAllElements()} and \l{QWebFrame::}{findFirstElement()}
89
functions with CSS selector queries.
91
Common web browser features, defaults and other settings can be configured
92
through the QWebSettings class. It is possible to provide defaults for all
93
QWebPage instances through the default settings. Individual attributes
94
can be overidden by the page specific settings object.
96
\section1 Netscape Plugin Support
98
\note Netscape plugin support is only available on desktop platforms.
100
Since WebKit supports the Netscape Plugin API, Qt applications can display
101
Web pages that embed common plugins on platforms for which those plugins
102
are available. To enable plugin support, the user must have the appropriate
103
binary files for those plugins installed and the \l{QWebSettings::PluginsEnabled}
104
attribute must be enabled for the application.
106
The following locations are searched for plugins:
109
\header \li Linux/Unix (X11)
112
\li \c{.mozilla/plugins} in the user's home directory
113
\li \c{.netscape/plugins} in the user's home directory
114
\li System locations, such as
116
\li \c{/usr/lib/browser/plugins}
117
\li \c{/usr/local/lib/mozilla/plugins}
118
\li \c{/usr/lib/firefox/plugins}
119
\li \c{/usr/lib64/browser-plugins}
120
\li \c{/usr/lib/browser-plugins}
121
\li \c{/usr/lib/mozilla/plugins}
122
\li \c{/usr/local/netscape/plugins}
123
\li \c{/opt/mozilla/plugins}
124
\li \c{/opt/mozilla/lib/plugins}
125
\li \c{/opt/netscape/plugins}
126
\li \c{/opt/netscape/communicator/plugins}
127
\li \c{/usr/lib/netscape/plugins}
128
\li \c{/usr/lib/netscape/plugins-libc5}
129
\li \c{/usr/lib/netscape/plugins-libc6}
130
\li \c{/usr/lib64/netscape/plugins}
131
\li \c{/usr/lib64/mozilla/plugins}
133
\li Locations specified by environment variables:
135
\li \c{$MOZILLA_HOME/plugins}
136
\li \c{$MOZ_PLUGIN_PATH}
137
\li \c{$QTWEBKIT_PLUGIN_PATH}
146
\li The user's \c{Application Data\Mozilla\plugins} directory
147
\li Standard system locations of plugins for Quicktime, Flash, etc.
155
\li \c{Library/Internet Plug-Ins} in the user's home directory
156
\li The system \c{/Library/Internet Plug-Ins} directory
161
\section1 License Information
163
This is a snapshot of the Qt port of WebKit. The exact version information
164
can be found in the \c{src/3rdparty/webkit/VERSION} file supplied with Qt.
166
Qt Commercial Edition licensees that wish to distribute applications that
167
use the QtWebKit module need to be aware of their obligations under the
168
GNU Library General Public License (LGPL).
170
Developers using the Open Source Edition can choose to redistribute
171
the module under the appropriate version of the GNU LGPL.
174
WebKit is licensed under the GNU Library General Public License.
175
Individual contributor names and copyright dates can be found
178
This library is free software; you can redistribute it and/or
179
modify it under the terms of the GNU Library General Public
180
License as published by the Free Software Foundation; either
181
version 2 of the License, or (at your option) any later version.
183
This library is distributed in the hope that it will be useful,
184
but WITHOUT ANY WARRANTY; without even the implied warranty of
185
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
186
Library General Public License for more details.
188
You should have received a copy of the GNU Library General Public License
189
along with this library; see the file COPYING.LIB. If not, write to
190
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
191
Boston, MA 02110-1301, USA.