<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QWebView Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QWebView Class Reference<br /><sup><sup>[<a href="qtwebkit.html">QtWebKit</a> module]</sup></sup></h1><p>The QWebView class provides a widget that is used to view and edit web documents. <a href="#details">More...</a></p> <p>Inherits <a href="qwidget.html">QWidget</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qwebview.html#QWebView">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qwebview.html#back">back</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwebview.html#changeEvent">changeEvent</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" /><b><a href="qwebview.html#contextMenuEvent">contextMenuEvent</a></b> (<i>self</i>, QContextMenuEvent)</li><li><div class="fn" />QWebView <b><a href="qwebview.html#createWindow">createWindow</a></b> (<i>self</i>, QWebPage.WebWindowType <i>type</i>)</li><li><div class="fn" /><b><a href="qwebview.html#dragEnterEvent">dragEnterEvent</a></b> (<i>self</i>, QDragEnterEvent)</li><li><div class="fn" /><b><a href="qwebview.html#dragLeaveEvent">dragLeaveEvent</a></b> (<i>self</i>, QDragLeaveEvent)</li><li><div class="fn" /><b><a href="qwebview.html#dragMoveEvent">dragMoveEvent</a></b> (<i>self</i>, QDragMoveEvent)</li><li><div class="fn" /><b><a href="qwebview.html#dropEvent">dropEvent</a></b> (<i>self</i>, QDropEvent)</li><li><div class="fn" />bool <b><a href="qwebview.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />bool <b><a href="qwebview.html#findText">findText</a></b> (<i>self</i>, QString <i>subString</i>, QWebPage.FindFlags <i>options</i> = 0)</li><li><div class="fn" /><b><a href="qwebview.html#focusInEvent">focusInEvent</a></b> (<i>self</i>, QFocusEvent)</li><li><div class="fn" />bool <b><a href="qwebview.html#focusNextPrevChild">focusNextPrevChild</a></b> (<i>self</i>, bool <i>next</i>)</li><li><div class="fn" /><b><a href="qwebview.html#focusOutEvent">focusOutEvent</a></b> (<i>self</i>, QFocusEvent)</li><li><div class="fn" /><b><a href="qwebview.html#forward">forward</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qwebview.html#hasSelection">hasSelection</a></b> (<i>self</i>)</li><li><div class="fn" />QWebHistory <b><a href="qwebview.html#history">history</a></b> (<i>self</i>)</li><li><div class="fn" />QIcon <b><a href="qwebview.html#icon">icon</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwebview.html#inputMethodEvent">inputMethodEvent</a></b> (<i>self</i>, QInputMethodEvent)</li><li><div class="fn" />QVariant <b><a href="qwebview.html#inputMethodQuery">inputMethodQuery</a></b> (<i>self</i>, Qt.InputMethodQuery <i>property</i>)</li><li><div class="fn" />bool <b><a href="qwebview.html#isModified">isModified</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwebview.html#keyPressEvent">keyPressEvent</a></b> (<i>self</i>, QKeyEvent)</li><li><div class="fn" /><b><a href="qwebview.html#keyReleaseEvent">keyReleaseEvent</a></b> (<i>self</i>, QKeyEvent)</li><li><div class="fn" /><b><a href="qwebview.html#load">load</a></b> (<i>self</i>, QUrl <i>url</i>)</li><li><div class="fn" /><b><a href="qwebview.html#load-2">load</a></b> (<i>self</i>, QNetworkRequest <i>request</i>, QNetworkAccessManager.Operation <i>operation</i> = QNetworkAccessManager.GetOperation, QByteArray <i>body</i> = QByteArray())</li><li><div class="fn" /><b><a href="qwebview.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qwebview.html#mouseMoveEvent">mouseMoveEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qwebview.html#mousePressEvent">mousePressEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qwebview.html#mouseReleaseEvent">mouseReleaseEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" />QWebPage <b><a href="qwebview.html#page">page</a></b> (<i>self</i>)</li><li><div class="fn" />QAction <b><a href="qwebview.html#pageAction">pageAction</a></b> (<i>self</i>, QWebPage.WebAction <i>action</i>)</li><li><div class="fn" /><b><a href="qwebview.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent <i>ev</i>)</li><li><div class="fn" /><b><a href="qwebview.html#print">print</a></b> (<i>self</i>, QPrinter <i>printer</i>)</li><li><div class="fn" /><b><a href="qwebview.html#print">print_</a></b> (<i>self</i>, QPrinter <i>printer</i>)</li><li><div class="fn" /><b><a href="qwebview.html#reload">reload</a></b> (<i>self</i>)</li><li><div class="fn" />QPainter.RenderHints <b><a href="qwebview.html#renderHints">renderHints</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwebview.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent <i>e</i>)</li><li><div class="fn" />QString <b><a href="qwebview.html#selectedHtml">selectedHtml</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qwebview.html#selectedText">selectedText</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwebview.html#setContent">setContent</a></b> (<i>self</i>, QByteArray <i>data</i>, QString <i>mimeType</i> = QString(), QUrl <i>baseUrl</i> = QUrl())</li><li><div class="fn" /><b><a href="qwebview.html#setHtml">setHtml</a></b> (<i>self</i>, QString <i>html</i>, QUrl <i>baseUrl</i> = QUrl())</li><li><div class="fn" /><b><a href="qwebview.html#setPage">setPage</a></b> (<i>self</i>, QWebPage <i>page</i>)</li><li><div class="fn" /><b><a href="qwebview.html#setRenderHint">setRenderHint</a></b> (<i>self</i>, QPainter.RenderHint <i>hint</i>, bool <i>enabled</i> = True)</li><li><div class="fn" /><b><a href="qwebview.html#setRenderHints">setRenderHints</a></b> (<i>self</i>, QPainter.RenderHints <i>hints</i>)</li><li><div class="fn" /><b><a href="qwebview.html#setTextSizeMultiplier">setTextSizeMultiplier</a></b> (<i>self</i>, float <i>factor</i>)</li><li><div class="fn" />QWebSettings <b><a href="qwebview.html#settings">settings</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwebview.html#setUrl">setUrl</a></b> (<i>self</i>, QUrl <i>url</i>)</li><li><div class="fn" /><b><a href="qwebview.html#setZoomFactor">setZoomFactor</a></b> (<i>self</i>, float <i>factor</i>)</li><li><div class="fn" />QSize <b><a href="qwebview.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwebview.html#stop">stop</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qwebview.html#textSizeMultiplier">textSizeMultiplier</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qwebview.html#title">title</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwebview.html#triggerPageAction">triggerPageAction</a></b> (<i>self</i>, QWebPage.WebAction <i>action</i>, bool <i>checked</i> = False)</li><li><div class="fn" />QUrl <b><a href="qwebview.html#url">url</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwebview.html#wheelEvent">wheelEvent</a></b> (<i>self</i>, QWheelEvent)</li><li><div class="fn" />float <b><a href="qwebview.html#zoomFactor">zoomFactor</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qwebview.html#iconChanged">iconChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qwebview.html#linkClicked">linkClicked</a></b> (const QUrl&)</li><li><div class="fn" />void <b><a href="qwebview.html#loadFinished">loadFinished</a></b> (bool)</li><li><div class="fn" />void <b><a href="qwebview.html#loadProgress">loadProgress</a></b> (int)</li><li><div class="fn" />void <b><a href="qwebview.html#loadStarted">loadStarted</a></b> ()</li><li><div class="fn" />void <b><a href="qwebview.html#selectionChanged">selectionChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qwebview.html#statusBarMessage">statusBarMessage</a></b> (const QString&)</li><li><div class="fn" />void <b><a href="qwebview.html#titleChanged">titleChanged</a></b> (const QString&)</li><li><div class="fn" />void <b><a href="qwebview.html#urlChanged">urlChanged</a></b> (const QUrl&)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QWebView class provides a widget that is used to view and edit web documents.</p> <p>QWebView is the main widget component of the <a href="qtwebkit.html">QtWebKit</a> web browsing module. It can be used in various applications to display web content live from the Internet.</p> <p>A web site can be loaded onto QWebView with the <a href="qwebview.html#load">load</a>() function. Like all Qt widgets, the <a href="qwidget.html#show">show</a>() function must be invoked in order to display QWebView. The snippet below illustrates this:</p> <pre class="cpp"> <span class="type">QWebView</span> <span class="operator">*</span>view <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QWebView</span>(parent); view<span class="operator">-</span><span class="operator">></span>load(<span class="type"><a href="qurl.html">QUrl</a></span>(<span class="string">"http://qt-project.org"</span>)); view<span class="operator">-</span><span class="operator">></span>show(); </pre> <p>Alternatively, <a href="qwebview.html#url-prop">setUrl</a>() can also be used to load a web site. If you have the HTML content readily available, you can use <a href="qwebview.html#setHtml">setHtml</a>() instead.</p> <p>The <a href="qwebview.html#loadStarted">loadStarted</a>() signal is emitted when the view begins loading. The <a href="qwebview.html#loadProgress">loadProgress</a>() signal, on the other hand, is emitted whenever an element of the web view completes loading, such as an embedded image, a script, etc. Finally, the <a href="qwebview.html#loadFinished">loadFinished</a>() signal is emitted when the view has loaded completely. It's argument - either <tt>true</tt> or <tt>false</tt> - indicates load success or failure.</p> <p>The <a href="qwebview.html#page">page</a>() function returns a pointer to the web page object. See <a href="#elements-of-qwebview">Elements of QWebView</a> for an explanation of how the web page is related to the view. To modify your web view's settings, you can access the <a href="qwebsettings.html">QWebSettings</a> object with the <a href="qwebview.html#settings">settings</a>() function. With <a href="qwebsettings.html">QWebSettings</a>, you can change the default fonts, enable or disable features such as JavaScript and plugins.</p> <p>The title of an HTML document can be accessed with the <a href="qwebview.html#title-prop">title</a>() property. Additionally, a web site may also specify an icon, which can be accessed using the <a href="qwebview.html#icon-prop">icon</a>() property. If the title or the icon changes, the corresponding <a href="qwebview.html#titleChanged">titleChanged</a>() and <a href="qwebview.html#iconChanged">iconChanged</a>() signals will be emitted. The <a href="qwebview.html#textSizeMultiplier">textSizeMultiplier</a>() property can be used to change the overall size of the text displayed in the web view.</p> <p>If you require a custom context menu, you can implement it by reimplementing <a href="qwidget.html#contextMenuEvent">contextMenuEvent()</a> and populating your <a href="qmenu.html">QMenu</a> with the actions obtained from <a href="qwebview.html#pageAction">pageAction</a>(). More functionality such as reloading the view, copying selected text to the clipboard, or pasting into the view, is also encapsulated within the <a href="qaction.html">QAction</a> objects returned by <a href="qwebview.html#pageAction">pageAction</a>(). These actions can be programmatically triggered using <a href="qwebview.html#triggerPageAction">triggerPageAction</a>(). Alternatively, the actions can be added to a toolbar or a menu directly. QWebView maintains the state of the returned actions but allows modification of action properties such as <a href="qaction.html#text-prop">text</a> or <a href="qaction.html#icon-prop">icon</a>.</p> <p>A QWebView can be printed onto a <a href="qprinter.html">QPrinter</a> using the <a href="qwebview.html#print">print_</a>() function. This function is marked as a slot and can be conveniently connected to <a href="qprintpreviewdialog.html">QPrintPreviewDialog</a>'s <a href="qprintpreviewdialog.html#paintRequested">paintRequested()</a> signal.</p> <p>If you want to provide support for web sites that allow the user to open new windows, such as pop-up windows, you can subclass QWebView and reimplement the <a href="qwebview.html#createWindow">createWindow</a>() function.</p> <a id="elements-of-qwebview" name="elements-of-qwebview" /> <h3>Elements of QWebView</h3> <p>QWebView consists of other objects such as <a href="qwebframe.html">QWebFrame</a> and <a href="qwebpage.html">QWebPage</a>. The flowchart below shows these elements are related.</p> <p class="centerAlign"><img alt="" src="images/qwebview-diagram.png" /></p> <p><b>Note:</b> It is possible to use <a href="qwebpage.html">QWebPage</a> and <a href="qwebframe.html">QWebFrame</a>, without using QWebView, if you do not require <a href="qwidget.html">QWidget</a> attributes. Nevertheless, <a href="qtwebkit.html">QtWebKit</a> depends on <a href="qtgui.html">QtGui</a>, so you should use a <a href="qapplication.html">QApplication</a> instead of <a href="qcoreapplication.html">QCoreApplication</a>.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QWebView" />QWebView.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an empty <a href="qwebview.html">QWebView</a> with parent <i>parent</i>.</p> <p><b>See also</b> <a href="qwebview.html#load">load</a>().</p> <h3 class="fn"><a name="back" />QWebView.back (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void back()</tt>.</p><p>Convenience slot that loads the previous document in the list of documents built by navigating links. Does nothing if there is no previous document.</p> <p>It is equivalent to</p> <pre class="cpp"> view<span class="operator">-</span><span class="operator">></span>page()<span class="operator">-</span><span class="operator">></span>triggerPageAction(<span class="type"><a href="qwebpage.html">QWebPage</a></span><span class="operator">.</span>GoBack); </pre> <p><b>See also</b> <a href="qwebview.html#forward">forward</a>() and <a href="qwebview.html#pageAction">pageAction</a>().</p> <h3 class="fn"><a name="changeEvent" />QWebView.changeEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget.changeEvent</a>().</p> <h3 class="fn"><a name="contextMenuEvent" />QWebView.contextMenuEvent (<i>self</i>, <a href="qcontextmenuevent.html">QContextMenuEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#contextMenuEvent">QWidget.contextMenuEvent</a>().</p> <h3 class="fn"><a name="createWindow" /><a href="qwebview.html">QWebView</a> QWebView.createWindow (<i>self</i>, <a href="qwebpage.html#WebWindowType-enum">QWebPage.WebWindowType</a> <i>type</i>)</h3><p>This function is called from the createWindow() method of the associated <a href="qwebpage.html">QWebPage</a>, each time the page wants to create a new window of the given <i>type</i>. This might be the result, for example, of a JavaScript request to open a document in a new window.</p> <p><b>Note:</b> If the createWindow() method of the associated page is reimplemented, this method is not called, unless explicitly done so in the reimplementation.</p> <p><b>Note:</b> In the cases when the window creation is being triggered by JavaScript, apart from reimplementing this method application must also set the JavaScriptCanOpenWindows attribute of <a href="qwebsettings.html">QWebSettings</a> to true in order for it to get called.</p> <p><b>See also</b> <a href="qwebpage.html#createWindow">QWebPage.createWindow</a>() and <a href="qwebpage.html#acceptNavigationRequest">QWebPage.acceptNavigationRequest</a>().</p> <h3 class="fn"><a name="dragEnterEvent" />QWebView.dragEnterEvent (<i>self</i>, <a href="qdragenterevent.html">QDragEnterEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#dragEnterEvent">QWidget.dragEnterEvent</a>().</p> <h3 class="fn"><a name="dragLeaveEvent" />QWebView.dragLeaveEvent (<i>self</i>, <a href="qdragleaveevent.html">QDragLeaveEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#dragLeaveEvent">QWidget.dragLeaveEvent</a>().</p> <h3 class="fn"><a name="dragMoveEvent" />QWebView.dragMoveEvent (<i>self</i>, <a href="qdragmoveevent.html">QDragMoveEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#dragMoveEvent">QWidget.dragMoveEvent</a>().</p> <h3 class="fn"><a name="dropEvent" />QWebView.dropEvent (<i>self</i>, <a href="qdropevent.html">QDropEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#dropEvent">QWidget.dropEvent</a>().</p> <h3 class="fn"><a name="event" />bool QWebView.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p> <h3 class="fn"><a name="findText" />bool QWebView.findText (<i>self</i>, QString <i>subString</i>, <a href="qwebpage-findflags.html">QWebPage.FindFlags</a> <i>options</i> = 0)</h3><p>Finds the specified string, <i>subString</i>, in the page, using the given <i>options</i>.</p> <p>If the HighlightAllOccurrences flag is passed, the function will highlight all occurrences that exist in the page. All subsequent calls will extend the highlight, rather than replace it, with occurrences of the new string.</p> <p>If the HighlightAllOccurrences flag is not passed, the function will select an occurrence and all subsequent calls will replace the current occurrence with the next one.</p> <p>To clear the selection, just pass an empty string.</p> <p>Returns true if <i>subString</i> was found; otherwise returns false.</p> <p><b>See also</b> <a href="qwebview.html#selectedText-prop">selectedText</a>() and <a href="qwebview.html#selectionChanged">selectionChanged</a>().</p> <h3 class="fn"><a name="focusInEvent" />QWebView.focusInEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#focusInEvent">QWidget.focusInEvent</a>().</p> <h3 class="fn"><a name="focusNextPrevChild" />bool QWebView.focusNextPrevChild (<i>self</i>, bool <i>next</i>)</h3><p>Reimplemented from <a href="qwidget.html#focusNextPrevChild">QWidget.focusNextPrevChild</a>().</p> <h3 class="fn"><a name="focusOutEvent" />QWebView.focusOutEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#focusOutEvent">QWidget.focusOutEvent</a>().</p> <h3 class="fn"><a name="forward" />QWebView.forward (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void forward()</tt>.</p><p>Convenience slot that loads the next document in the list of documents built by navigating links. Does nothing if there is no next document.</p> <p>It is equivalent to</p> <pre class="cpp"> view<span class="operator">-</span><span class="operator">></span>page()<span class="operator">-</span><span class="operator">></span>triggerPageAction(<span class="type"><a href="qwebpage.html">QWebPage</a></span><span class="operator">.</span>GoForward); </pre> <p><b>See also</b> <a href="qwebview.html#back">back</a>() and <a href="qwebview.html#pageAction">pageAction</a>().</p> <h3 class="fn"><a name="hasSelection" />bool QWebView.hasSelection (<i>self</i>)</h3><h3 class="fn"><a name="history" /><a href="qwebhistory.html">QWebHistory</a> QWebView.history (<i>self</i>)</h3><p>Returns a pointer to the view's history of navigated web pages.</p> <p>It is equivalent to</p> <pre class="cpp"> view<span class="operator">-</span><span class="operator">></span>page()<span class="operator">-</span><span class="operator">></span>history(); </pre> <h3 class="fn"><a name="icon" /><a href="qicon.html">QIcon</a> QWebView.icon (<i>self</i>)</h3><h3 class="fn"><a name="inputMethodEvent" />QWebView.inputMethodEvent (<i>self</i>, <a href="qinputmethodevent.html">QInputMethodEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#inputMethodEvent">QWidget.inputMethodEvent</a>().</p> <h3 class="fn"><a name="inputMethodQuery" />QVariant QWebView.inputMethodQuery (<i>self</i>, <a href="qt.html#InputMethodQuery-enum">Qt.InputMethodQuery</a> <i>property</i>)</h3><p>Reimplemented from <a href="qwidget.html#inputMethodQuery">QWidget.inputMethodQuery</a>().</p> <h3 class="fn"><a name="isModified" />bool QWebView.isModified (<i>self</i>)</h3><h3 class="fn"><a name="keyPressEvent" />QWebView.keyPressEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget.keyPressEvent</a>().</p> <h3 class="fn"><a name="keyReleaseEvent" />QWebView.keyReleaseEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#keyReleaseEvent">QWidget.keyReleaseEvent</a>().</p> <h3 class="fn"><a name="load" />QWebView.load (<i>self</i>, <a href="qurl.html">QUrl</a> <i>url</i>)</h3><p>Loads the specified <i>url</i> and displays it.</p> <p><b>Note:</b> The view remains the same until enough data has arrived to display the new <i>url</i>.</p> <p><b>See also</b> <a href="qwebview.html#url-prop">setUrl</a>(), <a href="qwebview.html#url-prop">url</a>(), <a href="qwebview.html#urlChanged">urlChanged</a>(), and <a href="qurl.html#fromUserInput">QUrl.fromUserInput</a>().</p> <h3 class="fn"><a name="load-2" />QWebView.load (<i>self</i>, <a href="qnetworkrequest.html">QNetworkRequest</a> <i>request</i>, <a href="qnetworkaccessmanager.html#Operation-enum">QNetworkAccessManager.Operation</a> <i>operation</i> = QNetworkAccessManager.GetOperation, <a href="qbytearray.html">QByteArray</a> <i>body</i> = QByteArray())</h3><p>Loads a network request, <i>request</i>, using the method specified in <i>operation</i>.</p> <p><i>body</i> is optional and is only used for POST operations.</p> <p><b>Note:</b> The view remains the same until enough data has arrived to display the new url.</p> <p><b>See also</b> <a href="qwebview.html#url-prop">url</a>() and <a href="qwebview.html#urlChanged">urlChanged</a>().</p> <h3 class="fn"><a name="mouseDoubleClickEvent" />QWebView.mouseDoubleClickEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mouseDoubleClickEvent">QWidget.mouseDoubleClickEvent</a>().</p> <h3 class="fn"><a name="mouseMoveEvent" />QWebView.mouseMoveEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget.mouseMoveEvent</a>().</p> <h3 class="fn"><a name="mousePressEvent" />QWebView.mousePressEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget.mousePressEvent</a>().</p> <h3 class="fn"><a name="mouseReleaseEvent" />QWebView.mouseReleaseEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget.mouseReleaseEvent</a>().</p> <h3 class="fn"><a name="page" /><a href="qwebpage.html">QWebPage</a> QWebView.page (<i>self</i>)</h3><p>Returns a pointer to the underlying web page.</p> <p><b>See also</b> <a href="qwebview.html#setPage">setPage</a>().</p> <h3 class="fn"><a name="pageAction" /><a href="qaction.html">QAction</a> QWebView.pageAction (<i>self</i>, <a href="qwebpage.html#WebAction-enum">QWebPage.WebAction</a> <i>action</i>)</h3><p>Returns a pointer to a <a href="qaction.html">QAction</a> that encapsulates the specified web action <i>action</i>.</p> <h3 class="fn"><a name="paintEvent" />QWebView.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a> <i>ev</i>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p> <h3 class="fn"><a name="print" />QWebView.print (<i>self</i>, <a href="qprinter.html">QPrinter</a> <i>printer</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void print(QPrinter *) const</tt>.</p><p>Prints the main frame to the given <i>printer</i>.</p> <p><b>See also</b> <a href="qwebframe.html#print">QWebFrame.print</a>() and <a href="qprintpreviewdialog.html">QPrintPreviewDialog</a>.</p> <h3 class="fn"><a name="print" />QWebView.print_ (<i>self</i>, <a href="qprinter.html">QPrinter</a> <i>printer</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void print(QPrinter *) const</tt>.</p><p>Prints the main frame to the given <i>printer</i>.</p> <p><b>See also</b> <a href="qwebframe.html#print">QWebFrame.print</a>() and <a href="qprintpreviewdialog.html">QPrintPreviewDialog</a>.</p> <h3 class="fn"><a name="reload" />QWebView.reload (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void reload()</tt>.</p><p>Reloads the current document.</p> <p><b>See also</b> <a href="qwebview.html#stop">stop</a>(), <a href="qwebview.html#pageAction">pageAction</a>(), and <a href="qwebview.html#loadStarted">loadStarted</a>().</p> <h3 class="fn"><a name="renderHints" /><a href="qpainter-renderhints.html">QPainter.RenderHints</a> QWebView.renderHints (<i>self</i>)</h3><h3 class="fn"><a name="resizeEvent" />QWebView.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget.resizeEvent</a>().</p> <h3 class="fn"><a name="selectedHtml" />QString QWebView.selectedHtml (<i>self</i>)</h3><h3 class="fn"><a name="selectedText" />QString QWebView.selectedText (<i>self</i>)</h3><h3 class="fn"><a name="setContent" />QWebView.setContent (<i>self</i>, <a href="qbytearray.html">QByteArray</a> <i>data</i>, QString <i>mimeType</i> = QString(), <a href="qurl.html">QUrl</a> <i>baseUrl</i> = QUrl())</h3><p>Sets the content of the web view to the specified content <i>data</i>. If the <i>mimeType</i> argument is empty it is currently assumed that the content is HTML but in future versions we may introduce auto-detection.</p> <p>External objects referenced in the content are located relative to <i>baseUrl</i>.</p> <p>The <i>data</i> is loaded immediately; external objects are loaded asynchronously.</p> <p><b>See also</b> <a href="qwebview.html#load">load</a>(), <a href="qwebview.html#setHtml">setHtml</a>(), and <a href="qwebframe.html#toHtml">QWebFrame.toHtml</a>().</p> <h3 class="fn"><a name="setHtml" />QWebView.setHtml (<i>self</i>, QString <i>html</i>, <a href="qurl.html">QUrl</a> <i>baseUrl</i> = QUrl())</h3><p>Sets the content of the web view to the specified <i>html</i>.</p> <p>External objects such as stylesheets or images referenced in the HTML document are located relative to <i>baseUrl</i>.</p> <p>The <i>html</i> is loaded immediately; external objects are loaded asynchronously.</p> <p>When using this method, WebKit assumes that external resources such as JavaScript programs or style sheets are encoded in UTF-8 unless otherwise specified. For example, the encoding of an external script can be specified through the charset attribute of the HTML script tag. Alternatively, the encoding can also be specified by the web server.</p> <p>This is a convenience function equivalent to setContent(html, "text/html", baseUrl).</p> <p><b>Warning:</b> This function works only for HTML, for other mime types (i.e. XHTML, SVG) <a href="qwebview.html#setContent">setContent</a>() should be used instead.</p> <p><b>See also</b> <a href="qwebview.html#load">load</a>(), <a href="qwebview.html#setContent">setContent</a>(), <a href="qwebframe.html#toHtml">QWebFrame.toHtml</a>(), and <a href="qwebframe.html#setContent">QWebFrame.setContent</a>().</p> <h3 class="fn"><a name="setPage" />QWebView.setPage (<i>self</i>, <a href="qwebpage.html">QWebPage</a> <i>page</i>)</h3><p>Makes <i>page</i> the new web page of the web view.</p> <p>The parent <a href="qobject.html">QObject</a> of the provided page remains the owner of the object. If the current page is a child of the web view, it will be deleted.</p> <p><b>See also</b> <a href="qwebview.html#page">page</a>().</p> <h3 class="fn"><a name="setRenderHint" />QWebView.setRenderHint (<i>self</i>, <a href="qpainter.html#RenderHint-enum">QPainter.RenderHint</a> <i>hint</i>, bool <i>enabled</i> = True)</h3><p>If <i>enabled</i> is true, enables the specified render <i>hint</i>; otherwise disables it.</p> <p>This function was introduced in Qt 4.6.</p> <p><b>See also</b> <a href="qwebview.html#renderHints-prop">renderHints</a> and <a href="qpainter.html#renderHints">QPainter.renderHints</a>().</p> <h3 class="fn"><a name="setRenderHints" />QWebView.setRenderHints (<i>self</i>, <a href="qpainter-renderhints.html">QPainter.RenderHints</a> <i>hints</i>)</h3><h3 class="fn"><a name="setTextSizeMultiplier" />QWebView.setTextSizeMultiplier (<i>self</i>, float <i>factor</i>)</h3><p>Sets the value of the multiplier used to scale the text in a Web page to the <i>factor</i> specified.</p> <p><b>See also</b> <a href="qwebview.html#textSizeMultiplier">textSizeMultiplier</a>().</p> <h3 class="fn"><a name="settings" /><a href="qwebsettings.html">QWebSettings</a> QWebView.settings (<i>self</i>)</h3><p>Returns a pointer to the view/page specific settings object.</p> <p>It is equivalent to</p> <pre class="cpp"> view<span class="operator">-</span><span class="operator">></span>page()<span class="operator">-</span><span class="operator">></span>settings(); </pre> <p><b>See also</b> <a href="qwebsettings.html#globalSettings">QWebSettings.globalSettings</a>().</p> <h3 class="fn"><a name="setUrl" />QWebView.setUrl (<i>self</i>, <a href="qurl.html">QUrl</a> <i>url</i>)</h3><h3 class="fn"><a name="setZoomFactor" />QWebView.setZoomFactor (<i>self</i>, float <i>factor</i>)</h3><h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QWebView.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a>().</p> <h3 class="fn"><a name="stop" />QWebView.stop (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void stop()</tt>.</p><p>Convenience slot that stops loading the document.</p> <p>It is equivalent to</p> <pre class="cpp"> view<span class="operator">-</span><span class="operator">></span>page()<span class="operator">-</span><span class="operator">></span>triggerPageAction(<span class="type"><a href="qwebpage.html">QWebPage</a></span><span class="operator">.</span>Stop); </pre> <p><b>See also</b> <a href="qwebview.html#reload">reload</a>(), <a href="qwebview.html#pageAction">pageAction</a>(), and <a href="qwebview.html#loadFinished">loadFinished</a>().</p> <h3 class="fn"><a name="textSizeMultiplier" />float QWebView.textSizeMultiplier (<i>self</i>)</h3><p>Returns the value of the multiplier used to scale the text in a Web page.</p> <p><b>See also</b> <a href="qwebview.html#setTextSizeMultiplier">setTextSizeMultiplier</a>().</p> <h3 class="fn"><a name="title" />QString QWebView.title (<i>self</i>)</h3><h3 class="fn"><a name="triggerPageAction" />QWebView.triggerPageAction (<i>self</i>, <a href="qwebpage.html#WebAction-enum">QWebPage.WebAction</a> <i>action</i>, bool <i>checked</i> = False)</h3><p>Triggers the specified <i>action</i>. If it is a checkable action the specified <i>checked</i> state is assumed.</p> <p>The following example triggers the copy action and therefore copies any selected text to the clipboard.</p> <pre class="cpp"> view<span class="operator">-</span><span class="operator">></span>triggerAction(<span class="type"><a href="qwebpage.html">QWebPage</a></span><span class="operator">.</span>Copy); </pre> <p><b>See also</b> <a href="qwebview.html#pageAction">pageAction</a>().</p> <h3 class="fn"><a name="url" /><a href="qurl.html">QUrl</a> QWebView.url (<i>self</i>)</h3><h3 class="fn"><a name="wheelEvent" />QWebView.wheelEvent (<i>self</i>, <a href="qwheelevent.html">QWheelEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#wheelEvent">QWidget.wheelEvent</a>().</p> <h3 class="fn"><a name="zoomFactor" />float QWebView.zoomFactor (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="iconChanged" />void iconChanged ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the icon of the page is loaded or changes.</p> <p>In order for icons to be loaded, you will need to set an icon database path using <a href="qwebsettings.html#setIconDatabasePath">QWebSettings.setIconDatabasePath</a>().</p> <p><b>See also</b> <a href="qwebview.html#icon-prop">icon</a>() and <a href="qwebsettings.html#setIconDatabasePath">QWebSettings.setIconDatabasePath</a>().</p> <h3 class="fn"><a name="linkClicked" />void linkClicked (const QUrl&)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the user clicks on a link and the page's linkDelegationPolicy property is set to delegate the link handling for the specified <i>url</i>.</p> <p><b>See also</b> <a href="qwebpage.html#linkDelegationPolicy-prop">QWebPage.linkDelegationPolicy</a>().</p> <h3 class="fn"><a name="loadFinished" />void loadFinished (bool)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when a load of the page is finished. <i>ok</i> will indicate whether the load was successful or any error occurred.</p> <p><b>See also</b> <a href="qwebview.html#loadStarted">loadStarted</a>().</p> <h3 class="fn"><a name="loadProgress" />void loadProgress (int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted every time an element in the web page completes loading and the overall loading progress advances.</p> <p>This signal tracks the progress of all child frames.</p> <p>The current value is provided by <i>progress</i> and scales from 0 to 100, which is the default range of <a href="qprogressbar.html">QProgressBar</a>.</p> <p><b>See also</b> <a href="qwebview.html#loadStarted">loadStarted</a>() and <a href="qwebview.html#loadFinished">loadFinished</a>().</p> <h3 class="fn"><a name="loadStarted" />void loadStarted ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when a new load of the page is started.</p> <p><b>See also</b> <a href="qwebview.html#loadProgress">loadProgress</a>() and <a href="qwebview.html#loadFinished">loadFinished</a>().</p> <h3 class="fn"><a name="selectionChanged" />void selectionChanged ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the selection changes.</p> <p><b>See also</b> <a href="qwebview.html#selectedText-prop">selectedText</a>().</p> <h3 class="fn"><a name="statusBarMessage" />void statusBarMessage (const QString&)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the status bar <i>text</i> is changed by the page.</p> <h3 class="fn"><a name="titleChanged" />void titleChanged (const QString&)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the <i>title</i> of the main frame changes.</p> <p><b>See also</b> <a href="qwebview.html#title-prop">title</a>().</p> <h3 class="fn"><a name="urlChanged" />void urlChanged (const QUrl&)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the <i>url</i> of the view changes.</p> <p><b>See also</b> <a href="qwebview.html#url-prop">url</a>() and <a href="qwebview.html#load">load</a>().</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>