QWebPage

Synopsis

Functions

Virtual functions

Signals

Detailed Description

The PySide.QtWebKit.QWebPage class provides an object to view and edit web documents.

PySide.QtWebKit.QWebPage holds a main frame responsible for web content, settings, the history of navigated links and actions. This class can be used, together with PySide.QtWebKit.QWebFrame , to provide functionality like PySide.QtWebKit.QWebView in a widget-less environment.

PySide.QtWebKit.QWebPage ‘s API is very similar to PySide.QtWebKit.QWebView , as you are still provided with common functions like PySide.QtWebKit.QWebPage.action() (known as PySide.QtWebKit.QWebView.pageAction() () in PySide.QtWebKit.QWebView ), PySide.QtWebKit.QWebPage.triggerAction() , PySide.QtWebKit.QWebPage.findText() and PySide.QtWebKit.QWebPage.settings() . More PySide.QtWebKit.QWebView -like functions can be found in the main frame of PySide.QtWebKit.QWebPage , obtained via the PySide.QtWebKit.QWebPage.mainFrame() function. For example, the PySide.QtWebKit.QWebFrame.load() (), PySide.QtWebKit.QWebFrame.setUrl() () and PySide.QtWebKit.QWebFrame.setHtml() () functions for PySide.QtWebKit.QWebPage can be accessed using PySide.QtWebKit.QWebFrame .

The PySide.QtWebKit.QWebPage.loadStarted() signal is emitted when the page begins to load.The PySide.QtWebKit.QWebPage.loadProgress() signal, on the other hand, is emitted whenever an element of the web page completes loading, such as an embedded image, a script, etc. Finally, the PySide.QtWebKit.QWebPage.loadFinished() signal is emitted when the page contents are loaded completely, independent of script execution or page rendering. Its argument, either true or false, indicates whether or not the load operation succeeded.

Using QWebPage in a Widget-less Environment

Before you begin painting a PySide.QtWebKit.QWebPage object, you need to set the size of the viewport by calling PySide.QtWebKit.QWebPage.setViewportSize() . Then, you invoke the main frame’s render function ( QWebFrame.render() ). An example of this is shown in the code snippet below.

Suppose we have a Thumbnail class as follows:

class Thumbnailer (QObject):
    def __init__(self, url):

        QObject.__init__(self)
        self.page = QWebPage()
        self.page.mainFrame().load(url)
        page.loadFinished[bool].connect(self.render)


    finished = Signal()


    def render(self):
        self.page.setViewportSize(self.page.mainFrame().contentsSize())
        image = QImage(self.page.viewportSize(), QImage.Format_ARGB32)
        painter = QPainter(image)

        self.page.mainFrame().render(painter)
        painter.end()

        thumbnail = image.scaled(400, 400)
        thumbnail.save("thumbnail.png")

        self.finished.emit()

The Thumbnail ‘s constructor takes in a url . We connect our PySide.QtWebKit.QWebPage object’s PySide.QtWebKit.QWebPage.loadFinished() signal to our private slot, render() .

QObject.__init__(self)
self.page = QWebPage()
self.page.mainFrame().load(url)
page.loadFinished[bool].connect(self.render)

The render() function shows how we can paint a thumbnail using a PySide.QtWebKit.QWebPage object.

def render(self):
    self.page.setViewportSize(self.page.mainFrame().contentsSize())
    image = QImage(self.page.viewportSize(), QImage.Format_ARGB32)
    painter = QPainter(image)

    self.page.mainFrame().render(painter)
    painter.end()

    thumbnail = image.scaled(400, 400)
    thumbnail.save("thumbnail.png")

    self.finished.emit()

We begin by setting the PySide.QtWebKit.QWebPage.viewportSize() and then we instantiate a PySide.QtGui.QImage object, image , with the same size as our PySide.QtWebKit.QWebPage.viewportSize() . This image is then sent as a parameter to painter . Next, we render the contents of the main frame and its subframes into painter . Finally, we save the scaled image.

See also

PySide.QtWebKit.QWebFrame

class PySide.QtWebKit.QWebPage([parent=None])
Parameters:parentPySide.QtCore.QObject

Constructs an empty PySide.QtWebKit.QWebPage with parent parent .

PySide.QtWebKit.QWebPage.ErrorDomain

This enum describes the domain of an ErrorPageExtensionOption object (i.e. the layer in which the error occurred).

Constant Description
QWebPage.QtNetwork The error occurred in the QtNetwork layer; the error code is of type QNetworkReply.NetworkError .
QWebPage.Http The error occurred in the HTTP layer; the error code is a HTTP status code (see QNetworkRequest.HttpStatusCodeAttribute ).
QWebPage.WebKit The error is an internal WebKit error.

Note

This enum was introduced or modified in Qt 4.6

PySide.QtWebKit.QWebPage.NavigationType

This enum describes the types of navigation available when browsing through hyperlinked documents.

Constant Description
QWebPage.NavigationTypeLinkClicked The user clicked on a link or pressed return on a focused link.
QWebPage.NavigationTypeFormSubmitted The user activated a submit button for an HTML form.
QWebPage.NavigationTypeBackOrForward Navigation to a previously shown document in the back or forward history is requested.
QWebPage.NavigationTypeReload The user activated the reload action.
QWebPage.NavigationTypeFormResubmitted An HTML form was submitted a second time.
QWebPage.NavigationTypeOther A navigation to another document using a method not listed above.
PySide.QtWebKit.QWebPage.WebAction

This enum describes the types of action which can be performed on the web page.

Actions only have an effect when they are applicable. The availability of actions can be be determined by checking PySide.QtGui.QAction.isEnabled() on the action returned by PySide.QtWebKit.QWebPage.action() .

One method of enabling the text editing, cursor movement, and text selection actions is by setting contentEditable() to true.

Constant Description
QWebPage.NoWebAction No action is triggered.
QWebPage.OpenLink Open the current link.
QWebPage.OpenLinkInNewWindow Open the current link in a new window.
QWebPage.OpenFrameInNewWindow Replicate the current frame in a new window.
QWebPage.DownloadLinkToDisk Download the current link to the disk.
QWebPage.CopyLinkToClipboard Copy the current link to the clipboard.
QWebPage.OpenImageInNewWindow Open the highlighted image in a new window.
QWebPage.DownloadImageToDisk Download the highlighted image to the disk.
QWebPage.CopyImageToClipboard Copy the highlighted image to the clipboard.
QWebPage.CopyImageUrlToClipboard Copy the highlighted image’s URL to the clipboard.
QWebPage.Back Navigate back in the history of navigated links.
QWebPage.Forward Navigate forward in the history of navigated links.
QWebPage.Stop Stop loading the current page.
QWebPage.StopScheduledPageRefresh Stop all pending page refresh/redirect requests.
QWebPage.Reload Reload the current page.
QWebPage.ReloadAndBypassCache Reload the current page, but do not use any local cache. (Added in Qt 4.6)
QWebPage.Cut Cut the content currently selected into the clipboard.
QWebPage.Copy Copy the content currently selected into the clipboard.
QWebPage.Paste Paste content from the clipboard.
QWebPage.Undo Undo the last editing action.
QWebPage.Redo Redo the last editing action.
QWebPage.MoveToNextChar Move the cursor to the next character.
QWebPage.MoveToPreviousChar Move the cursor to the previous character.
QWebPage.MoveToNextWord Move the cursor to the next word.
QWebPage.MoveToPreviousWord Move the cursor to the previous word.
QWebPage.MoveToNextLine Move the cursor to the next line.
QWebPage.MoveToPreviousLine Move the cursor to the previous line.
QWebPage.MoveToStartOfLine Move the cursor to the start of the line.
QWebPage.MoveToEndOfLine Move the cursor to the end of the line.
QWebPage.MoveToStartOfBlock Move the cursor to the start of the block.
QWebPage.MoveToEndOfBlock Move the cursor to the end of the block.
QWebPage.MoveToStartOfDocument Move the cursor to the start of the document.
QWebPage.MoveToEndOfDocument Move the cursor to the end of the document.
QWebPage.SelectNextChar Select to the next character.
QWebPage.SelectPreviousChar Select to the previous character.
QWebPage.SelectNextWord Select to the next word.
QWebPage.SelectPreviousWord Select to the previous word.
QWebPage.SelectNextLine Select to the next line.
QWebPage.SelectPreviousLine Select to the previous line.
QWebPage.SelectStartOfLine Select to the start of the line.
QWebPage.SelectEndOfLine Select to the end of the line.
QWebPage.SelectStartOfBlock Select to the start of the block.
QWebPage.SelectEndOfBlock Select to the end of the block.
QWebPage.SelectStartOfDocument Select to the start of the document.
QWebPage.SelectEndOfDocument Select to the end of the document.
QWebPage.DeleteStartOfWord Delete to the start of the word.
QWebPage.DeleteEndOfWord Delete to the end of the word.
QWebPage.SetTextDirectionDefault Set the text direction to the default direction.
QWebPage.SetTextDirectionLeftToRight Set the text direction to left-to-right.
QWebPage.SetTextDirectionRightToLeft Set the text direction to right-to-left.
QWebPage.ToggleBold Toggle the formatting between bold and normal weight.
QWebPage.ToggleItalic Toggle the formatting between italic and normal style.
QWebPage.ToggleUnderline Toggle underlining.
QWebPage.InspectElement Show the Web Inspector with the currently highlighted HTML element.
QWebPage.InsertParagraphSeparator Insert a new paragraph.
QWebPage.InsertLineSeparator Insert a new line.
QWebPage.SelectAll Selects all content.
QWebPage.PasteAndMatchStyle Paste content from the clipboard with current style.
QWebPage.RemoveFormat Removes formatting and style.
QWebPage.ToggleStrikethrough Toggle the formatting between strikethrough and normal style.
QWebPage.ToggleSubscript Toggle the formatting between subscript and baseline.
QWebPage.ToggleSuperscript Toggle the formatting between supercript and baseline.
QWebPage.InsertUnorderedList Toggles the selection between an ordered list and a normal block.
QWebPage.InsertOrderedList Toggles the selection between an ordered list and a normal block.
QWebPage.Indent Increases the indentation of the currently selected format block by one increment.
QWebPage.Outdent Decreases the indentation of the currently selected format block by one increment.
QWebPage.AlignCenter Applies center alignment to content.
QWebPage.AlignJustified Applies full justification to content.
QWebPage.AlignLeft Applies left justification to content.
QWebPage.AlignRight Applies right justification to content.
PySide.QtWebKit.QWebPage.WebWindowType

This enum describes the types of window that can be created by the PySide.QtWebKit.QWebPage.createWindow() function.

Constant Description
QWebPage.WebBrowserWindow The window is a regular web browser window.
QWebPage.WebModalDialog The window acts as modal dialog.
PySide.QtWebKit.QWebPage.PermissionPolicy

Note

This enum was introduced or modified in Qt 4.8

PySide.QtWebKit.QWebPage.FindFlag

This enum describes the options available to the PySide.QtWebKit.QWebPage.findText() function. The options can be OR-ed together from the following list:

Constant Description
QWebPage.FindBackward Searches backwards instead of forwards.
QWebPage.FindCaseSensitively By default PySide.QtWebKit.QWebPage.findText() works case insensitive. Specifying this option changes the behaviour to a case sensitive find operation.
QWebPage.FindWrapsAroundDocument Makes PySide.QtWebKit.QWebPage.findText() restart from the beginning of the document if the end was reached and the text was not found.
QWebPage.HighlightAllOccurrences Highlights all existing occurrences of a specific string. (This value was introduced in 4.6.)
PySide.QtWebKit.QWebPage.Feature

Note

This enum was introduced or modified in Qt 4.8

PySide.QtWebKit.QWebPage.Extension

This enum describes the types of extensions that the page can support. Before using these extensions, you should verify that the extension is supported by calling PySide.QtWebKit.QWebPage.supportsExtension() .

Constant Description
QWebPage.ChooseMultipleFilesExtension Whether the web page supports multiple file selection. This extension is invoked when the web content requests one or more file names, for example as a result of the user clicking on a “file upload” button in a HTML form where multiple file selection is allowed.
QWebPage.ErrorPageExtension Whether the web page can provide an error page when loading fails. (introduced in Qt 4.6)

See also

ChooseMultipleFilesExtensionOption ChooseMultipleFilesExtensionReturn ErrorPageExtensionOption ErrorPageExtensionReturn

PySide.QtWebKit.QWebPage.LinkDelegationPolicy

This enum defines the delegation policies a webpage can have when activating links and emitting the PySide.QtWebKit.QWebPage.linkClicked() signal.

Constant Description
QWebPage.DontDelegateLinks No links are delegated. Instead, PySide.QtWebKit.QWebPage tries to handle them all.
QWebPage.DelegateExternalLinks When activating links that point to documents not stored on the local filesystem or an equivalent - such as the Qt resource system - then PySide.QtWebKit.QWebPage.linkClicked() is emitted.
QWebPage.DelegateAllLinks Whenever a link is activated the PySide.QtWebKit.QWebPage.linkClicked() signal is emitted.
PySide.QtWebKit.QWebPage.acceptNavigationRequest(frame, request, type)
Parameters:
Return type:

PySide.QtCore.bool

This function is called whenever WebKit requests to navigate frame to the resource specified by request by means of the specified navigation type type .

If frame is a null pointer then navigation to a new window is requested. If the request is accepted PySide.QtWebKit.QWebPage.createWindow() will be called.

The default implementation interprets the page’s PySide.QtWebKit.QWebPage.linkDelegationPolicy() and emits linkClicked accordingly or returns true to let PySide.QtWebKit.QWebPage handle the navigation itself.

PySide.QtWebKit.QWebPage.action(action)
Parameters:actionPySide.QtWebKit.QWebPage.WebAction
Return type:PySide.QtGui.QAction

Returns a PySide.QtGui.QAction for the specified QWebPage.WebAction action .

The action is owned by the PySide.QtWebKit.QWebPage but you can customize the look by changing its properties.

PySide.QtWebKit.QWebPage also takes care of implementing the action, so that upon triggering the corresponding action is performed on the page.

PySide.QtWebKit.QWebPage.applicationCacheQuotaExceeded(origin, defaultOriginQuota)
Parameters:
PySide.QtWebKit.QWebPage.bytesReceived()
Return type:PySide.QtCore.quint64

Returns the number of bytes that were received from the network to render the current page.

PySide.QtWebKit.QWebPage.chooseFile(originatingFrame, oldFile)
Parameters:
  • originatingFramePySide.QtWebKit.QWebFrame
  • oldFile – unicode
Return type:

unicode

This function is called when the web content requests a file name, for example as a result of the user clicking on a “file upload” button in a HTML form.

A suggested filename may be provided in suggestedFile . The frame originating the request is provided as parentFrame .

See also

ChooseMultipleFilesExtension

PySide.QtWebKit.QWebPage.contentsChanged()
PySide.QtWebKit.QWebPage.createPlugin(classid, url, paramNames, paramValues)
Parameters:
  • classid – unicode
  • urlPySide.QtCore.QUrl
  • paramNames – list of strings
  • paramValues – list of strings
Return type:

PySide.QtCore.QObject

This function is called whenever WebKit encounters a HTML object element with type “application/x-qt-plugin”. It is called regardless of the value of QWebSettings.PluginsEnabled . The classid , url , paramNames and paramValues correspond to the HTML object element attributes and child elements to configure the embeddable object.

PySide.QtWebKit.QWebPage.createStandardContextMenu()
Return type:PySide.QtGui.QMenu

This function creates the standard context menu which is shown when the user clicks on the web page with the right mouse button. It is called from the default contextMenuEvent() handler. The popup menu’s ownership is transferred to the caller.

PySide.QtWebKit.QWebPage.createWindow(type)
Parameters:typePySide.QtWebKit.QWebPage.WebWindowType
Return type:PySide.QtWebKit.QWebPage

This function is called whenever WebKit wants to create a new window of the given type , for example when a JavaScript program requests to open a document in a new window.

If the new window can be created, the new window’s PySide.QtWebKit.QWebPage is returned; otherwise a null pointer is returned.

If the view associated with the web page is a PySide.QtWebKit.QWebView object, then the default implementation forwards the request to PySide.QtWebKit.QWebView ‘s PySide.QtWebKit.QWebPage.createWindow() function; otherwise it returns a null pointer.

If type is WebModalDialog , the application must call setWindowModality( Qt.ApplicationModal ) on the new window.

Note

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 PySide.QtWebKit.QWebSettings to true in order for it to get called.

PySide.QtWebKit.QWebPage.currentFrame()
Return type:PySide.QtWebKit.QWebFrame

Returns the frame currently active.

PySide.QtWebKit.QWebPage.databaseQuotaExceeded(frame, databaseName)
Parameters:
  • framePySide.QtWebKit.QWebFrame
  • databaseName – unicode
PySide.QtWebKit.QWebPage.downloadRequested(request)
Parameters:requestPySide.QtNetwork.QNetworkRequest
PySide.QtWebKit.QWebPage.extension(extension[, option=0[, output=0]])
Parameters:
Return type:

PySide.QtCore.bool

This virtual function can be reimplemented in a PySide.QtWebKit.QWebPage subclass to provide support for extensions. The option argument is provided as input to the extension; the output results can be stored in output .

The behavior of this function is determined by extension . The option and output values are typically casted to the corresponding types (for example, ChooseMultipleFilesExtensionOption and ChooseMultipleFilesExtensionReturn for ChooseMultipleFilesExtension ).

You can call PySide.QtWebKit.QWebPage.supportsExtension() to check if an extension is supported by the page.

Returns true if the extension was called successfully; otherwise returns false.

See also

PySide.QtWebKit.QWebPage.supportsExtension() QWebPage.Extension

PySide.QtWebKit.QWebPage.featurePermissionRequestCanceled(frame, feature)
Parameters:
PySide.QtWebKit.QWebPage.featurePermissionRequested(frame, feature)
Parameters:
PySide.QtWebKit.QWebPage.findText(subString[, options=0])
Parameters:
  • subString – unicode
  • optionsPySide.QtWebKit.QWebPage.FindFlags
Return type:

PySide.QtCore.bool

PySide.QtWebKit.QWebPage.focusNextPrevChild(next)
Parameters:nextPySide.QtCore.bool
Return type:PySide.QtCore.bool

Similar to QWidget.focusNextPrevChild() it focuses the next focusable web element if next is true; otherwise the previous element is focused.

Returns true if it can find a new focusable element, or false if it can’t.

PySide.QtWebKit.QWebPage.forwardUnsupportedContent()
Return type:PySide.QtCore.bool

This property holds whether PySide.QtWebKit.QWebPage should forward unsupported content.

If enabled, the PySide.QtWebKit.QWebPage.unsupportedContent() signal is emitted with a network reply that can be used to read the content.

If disabled, the download of such content is aborted immediately.

By default unsupported content is not forwarded.

PySide.QtWebKit.QWebPage.frameAt(pos)
Parameters:posPySide.QtCore.QPoint
Return type:PySide.QtWebKit.QWebFrame

Returns the frame at the given point pos , or 0 if there is no frame at that position.

PySide.QtWebKit.QWebPage.frameCreated(frame)
Parameters:framePySide.QtWebKit.QWebFrame
PySide.QtWebKit.QWebPage.geometryChangeRequested(geom)
Parameters:geomPySide.QtCore.QRect
PySide.QtWebKit.QWebPage.hasSelection()
Return type:PySide.QtCore.bool

This property holds whether this page contains selected content or not..

PySide.QtWebKit.QWebPage.history()
Return type:PySide.QtWebKit.QWebHistory

Returns a pointer to the view’s history of navigated web pages.

PySide.QtWebKit.QWebPage.inputMethodQuery(property)
Parameters:propertyPySide.QtCore.Qt.InputMethodQuery
Return type:object
PySide.QtWebKit.QWebPage.isContentEditable()
Return type:PySide.QtCore.bool

This property holds whether the content in this PySide.QtWebKit.QWebPage is editable or not.

If this property is enabled the contents of the page can be edited by the user through a visible cursor. If disabled (the default) only HTML elements in the web page with their contenteditable attribute set are editable.

See also

modified() PySide.QtWebKit.QWebPage.contentsChanged() QWebPage.WebAction

PySide.QtWebKit.QWebPage.isModified()
Return type:PySide.QtCore.bool

This property holds whether the page contains unsubmitted form data, or the contents have been changed..

By default, this property is false.

PySide.QtWebKit.QWebPage.javaScriptAlert(originatingFrame, msg)
Parameters:
  • originatingFramePySide.QtWebKit.QWebFrame
  • msg – unicode

This function is called whenever a JavaScript program running inside frame calls the alert() function with the message msg .

The default implementation shows the message, msg , with QMessageBox::information.

PySide.QtWebKit.QWebPage.javaScriptConfirm(originatingFrame, msg)
Parameters:
  • originatingFramePySide.QtWebKit.QWebFrame
  • msg – unicode
Return type:

PySide.QtCore.bool

This function is called whenever a JavaScript program running inside frame calls the confirm() function with the message, msg . Returns true if the user confirms the message; otherwise returns false.

The default implementation executes the query using QMessageBox::information with QMessageBox.Yes and QMessageBox.No buttons.

PySide.QtWebKit.QWebPage.javaScriptConsoleMessage(message, lineNumber, sourceID)
Parameters:
  • message – unicode
  • lineNumberPySide.QtCore.int
  • sourceID – unicode

This function is called whenever a JavaScript program tries to print a message to the web browser’s console.

For example in case of evaluation errors the source URL may be provided in sourceID as well as the lineNumber .

The default implementation prints nothing.

PySide.QtWebKit.QWebPage.javaScriptPrompt(originatingFrame, msg, defaultValue)
Parameters:
  • originatingFramePySide.QtWebKit.QWebFrame
  • msg – unicode
  • defaultValue – unicode
Return type:

PySequence

This function is called whenever a JavaScript program running inside frame tries to prompt the user for input. The program may provide an optional message, msg , as well as a default value for the input in defaultValue .

If the prompt was cancelled by the user the implementation should return false; otherwise the result should be written to result and true should be returned. If the prompt was not cancelled by the user, the implementation should return true and the result string must not be null.

The default implementation uses QInputDialog.getText() .

PySide.QtWebKit.QWebPage.linkClicked(url)
Parameters:urlPySide.QtCore.QUrl
PySide.QtWebKit.QWebPage.linkDelegationPolicy()
Return type:PySide.QtWebKit.QWebPage.LinkDelegationPolicy

This property holds how PySide.QtWebKit.QWebPage should delegate the handling of links through the PySide.QtWebKit.QWebPage.linkClicked() signal.

The default is to delegate no links.

PySide.QtWebKit.QWebPage.linkHovered(link, title, textContent)
Parameters:
  • link – unicode
  • title – unicode
  • textContent – unicode
PySide.QtWebKit.QWebPage.loadFinished(ok)
Parameters:okPySide.QtCore.bool
PySide.QtWebKit.QWebPage.loadProgress(progress)
Parameters:progressPySide.QtCore.int
PySide.QtWebKit.QWebPage.loadStarted()
PySide.QtWebKit.QWebPage.mainFrame()
Return type:PySide.QtWebKit.QWebFrame

Returns the main frame of the page.

The main frame provides access to the hierarchy of sub-frames and is also needed if you want to explicitly render a web page into a given painter.

PySide.QtWebKit.QWebPage.menuBarVisibilityChangeRequested(visible)
Parameters:visiblePySide.QtCore.bool
PySide.QtWebKit.QWebPage.microFocusChanged()
PySide.QtWebKit.QWebPage.networkAccessManager()
Return type:PySide.QtNetwork.QNetworkAccessManager

Returns the PySide.QtNetwork.QNetworkAccessManager that is responsible for serving network requests for this PySide.QtWebKit.QWebPage .

PySide.QtWebKit.QWebPage.palette()
Return type:PySide.QtGui.QPalette

This property holds the page’s palette.

The base brush of the palette is used to draw the background of the main frame.

By default, this property contains the application’s default palette.

PySide.QtWebKit.QWebPage.pluginFactory()
Return type:PySide.QtWebKit.QWebPluginFactory

Returns the PySide.QtWebKit.QWebPluginFactory that is responsible for creating plugins embedded into this PySide.QtWebKit.QWebPage . If no plugin factory is installed a null pointer is returned.

PySide.QtWebKit.QWebPage.preferredContentsSize()
Return type:PySide.QtCore.QSize

This property holds a custom size used for laying out the page contents..

By default all pages are laid out using the viewport of the page as the base.

As pages mostly are designed for desktop usage, they often do not layout properly on small devices as the contents require a certain view width. For this reason it is common to use a different layout size and then scale the contents to fit within the actual view.

If this property is set to a valid size, this size is used for all layout needs instead of the size of the viewport.

Setting an invalid size, makes the page fall back to using the viewport size for layout.

PySide.QtWebKit.QWebPage.printRequested(frame)
Parameters:framePySide.QtWebKit.QWebFrame
PySide.QtWebKit.QWebPage.qt_metacall()
PySide.QtWebKit.QWebPage.repaintRequested(dirtyRect)
Parameters:dirtyRectPySide.QtCore.QRect
PySide.QtWebKit.QWebPage.restoreFrameStateRequested(frame)
Parameters:framePySide.QtWebKit.QWebFrame
PySide.QtWebKit.QWebPage.saveFrameStateRequested(frame, item)
Parameters:
PySide.QtWebKit.QWebPage.scrollRequested(dx, dy, scrollViewRect)
Parameters:
PySide.QtWebKit.QWebPage.selectedHtml()
Return type:unicode

This property holds the HTML currently selected.

By default, this property contains an empty string.

PySide.QtWebKit.QWebPage.selectedText()
Return type:unicode

This property holds the text currently selected.

By default, this property contains an empty string.

PySide.QtWebKit.QWebPage.selectionChanged()
PySide.QtWebKit.QWebPage.setActualVisibleContentRect(rect)
Parameters:rectPySide.QtCore.QRect
PySide.QtWebKit.QWebPage.setContentEditable(editable)
Parameters:editablePySide.QtCore.bool

This property holds whether the content in this PySide.QtWebKit.QWebPage is editable or not.

If this property is enabled the contents of the page can be edited by the user through a visible cursor. If disabled (the default) only HTML elements in the web page with their contenteditable attribute set are editable.

See also

modified() PySide.QtWebKit.QWebPage.contentsChanged() QWebPage.WebAction

PySide.QtWebKit.QWebPage.setFeaturePermission(frame, feature, policy)
Parameters:
PySide.QtWebKit.QWebPage.setForwardUnsupportedContent(forward)
Parameters:forwardPySide.QtCore.bool

This property holds whether PySide.QtWebKit.QWebPage should forward unsupported content.

If enabled, the PySide.QtWebKit.QWebPage.unsupportedContent() signal is emitted with a network reply that can be used to read the content.

If disabled, the download of such content is aborted immediately.

By default unsupported content is not forwarded.

PySide.QtWebKit.QWebPage.setLinkDelegationPolicy(policy)
Parameters:policyPySide.QtWebKit.QWebPage.LinkDelegationPolicy

This property holds how PySide.QtWebKit.QWebPage should delegate the handling of links through the PySide.QtWebKit.QWebPage.linkClicked() signal.

The default is to delegate no links.

PySide.QtWebKit.QWebPage.setNetworkAccessManager(manager)
Parameters:managerPySide.QtNetwork.QNetworkAccessManager

Sets the PySide.QtNetwork.QNetworkAccessManager manager responsible for serving network requests for this PySide.QtWebKit.QWebPage .

Note

It is currently not supported to change the network access manager after the PySide.QtWebKit.QWebPage has used it. The results of doing this are undefined.

PySide.QtWebKit.QWebPage.setPalette(palette)
Parameters:palettePySide.QtGui.QPalette

This property holds the page’s palette.

The base brush of the palette is used to draw the background of the main frame.

By default, this property contains the application’s default palette.

PySide.QtWebKit.QWebPage.setPluginFactory(factory)
Parameters:factoryPySide.QtWebKit.QWebPluginFactory

Sets the PySide.QtWebKit.QWebPluginFactory factory responsible for creating plugins embedded into this PySide.QtWebKit.QWebPage .

Note: The plugin factory is only used if the QWebSettings.PluginsEnabled attribute is enabled.

PySide.QtWebKit.QWebPage.setPreferredContentsSize(size)
Parameters:sizePySide.QtCore.QSize

This property holds a custom size used for laying out the page contents..

By default all pages are laid out using the viewport of the page as the base.

As pages mostly are designed for desktop usage, they often do not layout properly on small devices as the contents require a certain view width. For this reason it is common to use a different layout size and then scale the contents to fit within the actual view.

If this property is set to a valid size, this size is used for all layout needs instead of the size of the viewport.

Setting an invalid size, makes the page fall back to using the viewport size for layout.

PySide.QtWebKit.QWebPage.setView(view)
Parameters:viewPySide.QtGui.QWidget

Sets the view that is associated with the web page.

PySide.QtWebKit.QWebPage.setViewportSize(size)
Parameters:sizePySide.QtCore.QSize

This property holds the size of the viewport.

The size affects for example the visibility of scrollbars if the document is larger than the viewport.

By default, for a newly-created Web page, this property contains a size with zero width and height.

PySide.QtWebKit.QWebPage.settings()
Return type:PySide.QtWebKit.QWebSettings

Returns a pointer to the page’s settings object.

PySide.QtWebKit.QWebPage.shouldInterruptJavaScript()
Return type:PySide.QtCore.bool

This function is called when a JavaScript program is running for a long period of time.

If the user wanted to stop the JavaScript the implementation should return true; otherwise false.

The default implementation executes the query using QMessageBox::information with QMessageBox.Yes and QMessageBox.No buttons.

Warning

Because of binary compatibility constraints, this function is not virtual. If you want to provide your own implementation in a PySide.QtWebKit.QWebPage subclass, reimplement the PySide.QtWebKit.QWebPage.shouldInterruptJavaScript() slot in your subclass instead. QtWebKit will dynamically detect the slot and call it.

PySide.QtWebKit.QWebPage.statusBarMessage(text)
Parameters:text – unicode
PySide.QtWebKit.QWebPage.statusBarVisibilityChangeRequested(visible)
Parameters:visiblePySide.QtCore.bool
PySide.QtWebKit.QWebPage.supportedContentTypes()
Return type:list of strings

Returns the list of all content types supported by PySide.QtWebKit.QWebPage .

PySide.QtWebKit.QWebPage.supportsContentType(mimeType)
Parameters:mimeType – unicode
Return type:PySide.QtCore.bool

Returns true if PySide.QtWebKit.QWebPage can handle the given mimeType ; otherwise, returns false.

PySide.QtWebKit.QWebPage.supportsExtension(extension)
Parameters:extensionPySide.QtWebKit.QWebPage.Extension
Return type:PySide.QtCore.bool

This virtual function returns true if the web page supports extension ; otherwise false is returned.

PySide.QtWebKit.QWebPage.swallowContextMenuEvent(event)
Parameters:eventPySide.QtGui.QContextMenuEvent
Return type:PySide.QtCore.bool

Filters the context menu event, event , through handlers for scrollbars and custom event handlers in the web page. Returns true if the event was handled; otherwise false.

A web page may swallow a context menu event through a custom event handler, allowing for context menus to be implemented in HTML/JavaScript. This is used by Google Maps, for example.

PySide.QtWebKit.QWebPage.toolBarVisibilityChangeRequested(visible)
Parameters:visiblePySide.QtCore.bool
PySide.QtWebKit.QWebPage.totalBytes()
Return type:PySide.QtCore.quint64

Returns the total number of bytes that were received from the network to render the current page, including extra content such as embedded images.

PySide.QtWebKit.QWebPage.triggerAction(action[, checked=false])
Parameters:

This function can be called to trigger the specified action . It is also called by QtWebKit if the user triggers the action, for example through a context menu item.

If action is a checkable action then checked specified whether the action is toggled or not.

PySide.QtWebKit.QWebPage.undoStack()
Return type:PySide.QtGui.QUndoStack

Returns a pointer to the undo stack used for editable content.

See also

modified()

PySide.QtWebKit.QWebPage.unsupportedContent(reply)
Parameters:replyPySide.QtNetwork.QNetworkReply
PySide.QtWebKit.QWebPage.updatePositionDependentActions(pos)
Parameters:posPySide.QtCore.QPoint

Updates the page’s actions depending on the position pos . For example if pos is over an image element the CopyImageToClipboard action is enabled.

PySide.QtWebKit.QWebPage.userAgentForUrl(url)
Parameters:urlPySide.QtCore.QUrl
Return type:unicode

This function is called when a user agent for HTTP requests is needed. You can reimplement this function to dynamically return different user agents for different URLs, based on the url parameter.

The default implementation returns the following value:

“Mozilla/5.0 (%Platform%%Security%%Subplatform%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko) %AppVersion Safari/%WebKitVersion%”

On mobile platforms such as Symbian S60 and Maemo, “Mobile Safari” is used instead of “Safari”.

In this string the following values are replaced at run-time:

  • %Platform% expands to the windowing system followed by ”; ” if it is not Windows (e.g. “X11; ”).
  • %Security% expands to “N; ” if SSL is disabled.
  • %Subplatform% expands to the operating system version (e.g. “Windows NT 6.1” or “Intel Mac OS X 10.5”).
  • %WebKitVersion% is the version of WebKit the application was compiled against.
  • %AppVersion% expands to QCoreApplication.applicationName() / QCoreApplication.applicationVersion() if they’re set; otherwise defaulting to Qt and the current Qt version.
PySide.QtWebKit.QWebPage.view()
Return type:PySide.QtGui.QWidget

Returns the view widget that is associated with the web page.

PySide.QtWebKit.QWebPage.viewportChangeRequested()
PySide.QtWebKit.QWebPage.viewportSize()
Return type:PySide.QtCore.QSize

This property holds the size of the viewport.

The size affects for example the visibility of scrollbars if the document is larger than the viewport.

By default, for a newly-created Web page, this property contains a size with zero width and height.

PySide.QtWebKit.QWebPage.windowCloseRequested()