| 1 | /*! | 
|---|
| 2 | \module QtWebKit | 
|---|
| 3 | \title QtWebKit Module | 
|---|
| 4 | \contentspage Qt's Modules | 
|---|
| 5 | \previouspage QtSvg | 
|---|
| 6 | \nextpage QtXml | 
|---|
| 7 | \ingroup architecture | 
|---|
| 8 | \ingroup modules | 
|---|
| 9 | \brief An introduction to the QtWebKit module. | 
|---|
| 10 |  | 
|---|
| 11 | \keyword Browser | 
|---|
| 12 | \keyword Web Browser | 
|---|
| 13 |  | 
|---|
| 14 | \since 4.4 | 
|---|
| 15 |  | 
|---|
| 16 | QtWebKit provides a Web browser engine that makes it easy to embed content | 
|---|
| 17 | from the World Wide Web into your Qt application. At the same time Web | 
|---|
| 18 | content can be enhanced with native controls. | 
|---|
| 19 |  | 
|---|
| 20 | QtWebKit provides facilities for rendering of HyperText Markup Language | 
|---|
| 21 | (HTML), Extensible HyperText Markup Language (XHTML) and Scalable Vector | 
|---|
| 22 | Graphics (SVG) documents, styled using Cascading Style Sheets (CSS) and | 
|---|
| 23 | scripted with JavaScript. | 
|---|
| 24 |  | 
|---|
| 25 | A bridge between the JavaScript execution environment and the Qt object | 
|---|
| 26 | model makes it possible for custom QObjects to be scripted. Integration | 
|---|
| 27 | with the Qt networking module enables Web pages to be transparently loaded | 
|---|
| 28 | from Web servers, the local file system or even the Qt resource system. | 
|---|
| 29 |  | 
|---|
| 30 | In addition to providing pure rendering features, HTML documents can be | 
|---|
| 31 | made fully editable to the user through the use of the \c{contenteditable} | 
|---|
| 32 | attribute on HTML elements. | 
|---|
| 33 |  | 
|---|
| 34 | QtWebKit is based on the Open Source WebKit engine. More information about | 
|---|
| 35 | WebKit itself can be found on the \l{WebKit Open Source Project} Web site. | 
|---|
| 36 |  | 
|---|
| 37 | The QtWebKit module is part of the \l{Qt Full Framework Edition}, and the | 
|---|
| 38 | \l{Open Source Versions of Qt}. | 
|---|
| 39 |  | 
|---|
| 40 | \note Building the QtWebKit module with debugging symbols is problematic | 
|---|
| 41 | on many platforms due to the size of the WebKit engine. We recommend | 
|---|
| 42 | building the module in release mode only for embedded platforms. | 
|---|
| 43 |  | 
|---|
| 44 | \note Web site icons, also known as "FavIcons", are currently not supported | 
|---|
| 45 | on Windows. We plan to address this in a future release. | 
|---|
| 46 |  | 
|---|
| 47 | \note WebKit has certain minimum requirements that must be met on | 
|---|
| 48 | Embedded Linux systems. See the \l{Qt for Embedded Linux Requirements} | 
|---|
| 49 | document for more information. | 
|---|
| 50 |  | 
|---|
| 51 | Topics: | 
|---|
| 52 |  | 
|---|
| 53 | \tableofcontents | 
|---|
| 54 |  | 
|---|
| 55 | \section1 Configuring the Build Process | 
|---|
| 56 |  | 
|---|
| 57 | Applications that use QtWebKit's classes need to be configured to be built | 
|---|
| 58 | against the QtWebKit module. The following declaration in a \c qmake | 
|---|
| 59 | project file ensures that an application is compiled and linked | 
|---|
| 60 | appropriately: | 
|---|
| 61 |  | 
|---|
| 62 | \snippet doc/src/snippets/code/doc_src_qtwebkit.qdoc 0 | 
|---|
| 63 |  | 
|---|
| 64 | This line is necessary because only the QtCore and QtGui modules are used | 
|---|
| 65 | in the default build process. | 
|---|
| 66 |  | 
|---|
| 67 | To include the definitions of the module's classes, use the following | 
|---|
| 68 | directive: | 
|---|
| 69 |  | 
|---|
| 70 | \snippet doc/src/snippets/code/doc_src_qtwebkit.qdoc 1 | 
|---|
| 71 |  | 
|---|
| 72 | \section1 Architecture | 
|---|
| 73 |  | 
|---|
| 74 | The easiest way to render content is through the QWebView class. As a | 
|---|
| 75 | widget it can be embedded into your forms or a graphics view, and it | 
|---|
| 76 | provides convenience functions for downloading and rendering web sites. | 
|---|
| 77 |  | 
|---|
| 78 | \snippet snippets/webkit/simple/main.cpp Using QWebView | 
|---|
| 79 |  | 
|---|
| 80 | QWebView acts as a view onto Web pages, each of which is represented by an | 
|---|
| 81 | instance of the QWebPage class. QWebPage provides access to the document | 
|---|
| 82 | structure in a page, describing features such as frames, the navigation | 
|---|
| 83 | history, and the undo/redo stack for editable content. | 
|---|
| 84 |  | 
|---|
| 85 | HTML documents can be nested using frames in a frameset. An individual | 
|---|
| 86 | frame in HTML is represented using the QWebFrame class. It includes the | 
|---|
| 87 | bridge to the JavaScript window object and can be painted using QPainter. | 
|---|
| 88 | Each QWebPage has one QWebFrame object as its main frame. | 
|---|
| 89 |  | 
|---|
| 90 | Individual browser features, defaults and other settings can be configured | 
|---|
| 91 | through the QWebSettings class. It is possible to provide defaults for all | 
|---|
| 92 | QWebPage instances through the default settings. Individual attributes | 
|---|
| 93 | can be overidden by the page specific settings object. | 
|---|
| 94 |  | 
|---|
| 95 | \section1 Netscape Plugin Support | 
|---|
| 96 |  | 
|---|
| 97 | Since WebKit supports the Netscape Plugin API, Qt applications can display | 
|---|
| 98 | Web pages that embed common plugins, as long as the user has the appropriate | 
|---|
| 99 | binary files for those plugins installed. | 
|---|
| 100 |  | 
|---|
| 101 | The following locations are searched for plugins: | 
|---|
| 102 |  | 
|---|
| 103 | \table | 
|---|
| 104 | \header \o Linux/Unix  \o Windows | 
|---|
| 105 | \row \o{1,3} | 
|---|
| 106 | \list | 
|---|
| 107 | \o \c{.mozilla/plugins} in the user's home directory | 
|---|
| 108 | \o \c{.netscape/plugins} in the user's home directory | 
|---|
| 109 | \o System locations, such as | 
|---|
| 110 | \list | 
|---|
| 111 | \o \c{/usr/lib/browser/plugins} | 
|---|
| 112 | \o \c{/usr/local/lib/mozilla/plugins} | 
|---|
| 113 | \o \c{/usr/lib/firefox/plugins} | 
|---|
| 114 | \o \c{/usr/lib64/browser-plugins} | 
|---|
| 115 | \o \c{/usr/lib/browser-plugins} | 
|---|
| 116 | \o \c{/usr/lib/mozilla/plugins} | 
|---|
| 117 | \o \c{/usr/local/netscape/plugins} | 
|---|
| 118 | \o \c{/opt/mozilla/plugins} | 
|---|
| 119 | \o \c{/opt/mozilla/lib/plugins} | 
|---|
| 120 | \o \c{/opt/netscape/plugins} | 
|---|
| 121 | \o \c{/opt/netscape/communicator/plugins} | 
|---|
| 122 | \o \c{/usr/lib/netscape/plugins} | 
|---|
| 123 | \o \c{/usr/lib/netscape/plugins-libc5} | 
|---|
| 124 | \o \c{/usr/lib/netscape/plugins-libc6} | 
|---|
| 125 | \o \c{/usr/lib64/netscape/plugins} | 
|---|
| 126 | \o \c{/usr/lib64/mozilla/plugins} | 
|---|
| 127 | \endlist | 
|---|
| 128 | \o Locations specified by environment variables: | 
|---|
| 129 | \list | 
|---|
| 130 | \o \c{$MOZILLA_HOME/plugins} | 
|---|
| 131 | \o \c{$MOZ_PLUGIN_PATH} | 
|---|
| 132 | \o \c{$QTWEBKIT_PLUGIN_PATH} | 
|---|
| 133 | \endlist | 
|---|
| 134 | \endlist | 
|---|
| 135 |  | 
|---|
| 136 | \o | 
|---|
| 137 | \list | 
|---|
| 138 | \o The user's \c{Application Data\Mozilla\plugins} directory | 
|---|
| 139 | \o Standard system locations of plugins for Quicktime, Flash, etc. | 
|---|
| 140 | \endlist | 
|---|
| 141 |  | 
|---|
| 142 | \row | 
|---|
| 143 | \raw HTML | 
|---|
| 144 | <th class="qt-style">Mac OS X</th> | 
|---|
| 145 | \endraw | 
|---|
| 146 | \row | 
|---|
| 147 | \o | 
|---|
| 148 | \list | 
|---|
| 149 | \o \c{Library/Internet Plug-Ins} in the user's home directory | 
|---|
| 150 | \o The system \c{/Library/Internet Plug-Ins} directory | 
|---|
| 151 | \endlist | 
|---|
| 152 | \endtable | 
|---|
| 153 |  | 
|---|
| 154 | \section1 License Information | 
|---|
| 155 |  | 
|---|
| 156 | This is a snapshot of the Qt port of WebKit. The exact version information | 
|---|
| 157 | can be found in the \c{src/3rdparty/webkit/VERSION} file supplied with Qt. | 
|---|
| 158 |  | 
|---|
| 159 | Qt Commercial Edition licensees that wish to distribute applications that | 
|---|
| 160 | use the QtWebKit module need to be aware of their obligations under the | 
|---|
| 161 | GNU Lesser General Public License (LGPL). | 
|---|
| 162 |  | 
|---|
| 163 | Developers using the Open Source Edition can choose to redistribute | 
|---|
| 164 | the module under the appropriate version of the GNU LGPL; version 2.1 | 
|---|
| 165 | for applications and libraries licensed under the GNU GPL version 2, | 
|---|
| 166 | or version 3 for applications and libraries licensed under the GNU | 
|---|
| 167 | GPL version 2. | 
|---|
| 168 |  | 
|---|
| 169 | \legalese | 
|---|
| 170 | WebKit is licensed under the GNU Library General Public License. | 
|---|
| 171 | Individual contributor names and copyright dates can be found | 
|---|
| 172 | inline in the code. | 
|---|
| 173 |  | 
|---|
| 174 | This library is free software; you can redistribute it and/or | 
|---|
| 175 | modify it under the terms of the GNU Library General Public | 
|---|
| 176 | License as published by the Free Software Foundation; either | 
|---|
| 177 | version 2 of the License, or (at your option) any later version. | 
|---|
| 178 |  | 
|---|
| 179 | This library is distributed in the hope that it will be useful, | 
|---|
| 180 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 181 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
|---|
| 182 | Library General Public License for more details. | 
|---|
| 183 |  | 
|---|
| 184 | You should have received a copy of the GNU Library General Public License | 
|---|
| 185 | along with this library; see the file COPYING.LIB.  If not, write to | 
|---|
| 186 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 
|---|
| 187 | Boston, MA 02110-1301, USA. | 
|---|
| 188 | \endlegalese | 
|---|
| 189 | */ | 
|---|