QGraphicsWebView

Inheritance diagram of QGraphicsWebView

Note

This class was introduced in Qt 4.6

Synopsis

Functions

Slots

Signals

Detailed Description

The PySide.QtWebKit.QGraphicsWebView class allows Web content to be added to a GraphicsView .

An instance of this class renders Web content from a URL or supplied as data, using features of the QtWebKit module.

If the width and height of the item are not set, they will default to 800 and 600, respectively. If the Web page contents is larger than that, scrollbars will be shown if not disabled explicitly.

Browser Features

Many of the functions, signals and properties provided by PySide.QtWebKit.QWebView are also available for this item, making it simple to adapt existing code to use PySide.QtWebKit.QGraphicsWebView instead of PySide.QtWebKit.QWebView .

The item uses a PySide.QtWebKit.QWebPage object to perform the rendering of Web content, and this can be obtained with the PySide.QtWebKit.QGraphicsWebView.page() function, enabling the document itself to be accessed and modified.

As with PySide.QtWebKit.QWebView , the item records the browsing history using a PySide.QtWebKit.QWebHistory object, accessible using the PySide.QtWebKit.QGraphicsWebView.history() function. The PySide.QtWebKit.QWebSettings object that defines the configuration of the browser can be obtained with the PySide.QtWebKit.QGraphicsWebView.settings() function, enabling features like plugin support to be customized for each item.

class PySide.QtWebKit.QGraphicsWebView([parent=None])
Parameters:parentPySide.QtGui.QGraphicsItem

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

PySide.QtWebKit.QGraphicsWebView.back()

Convenience slot that loads the previous document in the list of documents built by navigating links. Does nothing if there is no previous document.

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

PySide.QtCore.bool

PySide.QtWebKit.QGraphicsWebView.forward()

Convenience slot that loads the next document in the list of documents built by navigating links. Does nothing if there is no next document.

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

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

It is equivalent to

view.page().history()
PySide.QtWebKit.QGraphicsWebView.icon()
Return type:PySide.QtGui.QIcon

This property holds the icon associated with the web page currently viewed.

By default, this property contains a null icon.

PySide.QtWebKit.QGraphicsWebView.iconChanged()
PySide.QtWebKit.QGraphicsWebView.isModified()
Return type:PySide.QtCore.bool

This property holds whether the document was modified by the user.

Parts of HTML documents can be editable for example through the contenteditable attribute on HTML elements.

By default, this property is false.

PySide.QtWebKit.QGraphicsWebView.isTiledBackingStoreFrozen()
Return type:PySide.QtCore.bool

This property holds whether the tiled backing store updates its contents.

If the tiled backing store is enabled using QWebSettings.TiledBackingStoreEnabled attribute, this property can be used to disable backing store updates temporarily. This can be useful for example for running a smooth animation that changes the scale of the PySide.QtWebKit.QGraphicsWebView .

When the backing store is unfrozen, its contents will be automatically updated to match the current state of the document. If the PySide.QtWebKit.QGraphicsWebView scale was changed, the backing store is also re-rendered using the new scale.

If the tiled backing store is not enabled, this property does nothing.

See also

QWebSettings.TiledBackingStoreEnabled QGraphicsObject.scale

PySide.QtWebKit.QGraphicsWebView.linkClicked(arg__1)
Parameters:arg__1PySide.QtCore.QUrl
PySide.QtWebKit.QGraphicsWebView.load(request[, operation=QNetworkAccessManager.GetOperation[, body=QByteArray()]])
Parameters:
PySide.QtWebKit.QGraphicsWebView.load(url)
Parameters:urlPySide.QtCore.QUrl

Loads the specified url and displays it.

Note

The view remains the same until enough data has arrived to display the new url .

PySide.QtWebKit.QGraphicsWebView.loadFinished(arg__1)
Parameters:arg__1PySide.QtCore.bool
PySide.QtWebKit.QGraphicsWebView.loadProgress(progress)
Parameters:progressPySide.QtCore.int
PySide.QtWebKit.QGraphicsWebView.loadStarted()
PySide.QtWebKit.QGraphicsWebView.page()
Return type:PySide.QtWebKit.QWebPage

Returns a pointer to the underlying web page.

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

Reloads the current document.

PySide.QtWebKit.QGraphicsWebView.renderHints()
Return type:PySide.QtGui.QPainter.RenderHints
PySide.QtWebKit.QGraphicsWebView.resizesToContents()
Return type:PySide.QtCore.bool

This property holds whether the size of the PySide.QtWebKit.QGraphicsWebView and its viewport changes to match the contents size.

If this property is set, the PySide.QtWebKit.QGraphicsWebView will automatically change its size to match the size of the main frame contents. As a result the top level frame will never have scrollbars. It will also make CSS fixed positioning to behave like absolute positioning with elements positioned relative to the document instead of the viewport.

This property should be used in conjunction with the QWebPage.preferredContentsSize property. If not explicitly set, the preferredContentsSize is automatically set to a reasonable value.

PySide.QtWebKit.QGraphicsWebView.setContent(data[, mimeType=""[, baseUrl=QUrl()]])
Parameters:

Sets the content of the web graphicsitem to the specified content data . If the mimeType argument is empty it is currently assumed that the content is HTML but in future versions we may introduce auto-detection.

External objects referenced in the content are located relative to baseUrl .

The data is loaded immediately; external objects are loaded asynchronously.

PySide.QtWebKit.QGraphicsWebView.setHtml(html[, baseUrl=QUrl()])
Parameters:

Sets the content of the web view to the specified html .

External objects such as stylesheets or images referenced in the HTML document are located relative to baseUrl .

The html is loaded immediately; external objects are loaded asynchronously.

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.

PySide.QtWebKit.QGraphicsWebView.setPage(arg__1)
Parameters:arg__1PySide.QtWebKit.QWebPage

Makes page the new web page of the web graphicsitem.

The parent PySide.QtCore.QObject of the provided page remains the owner of the object. If the current document is a child of the web view, it will be deleted.

PySide.QtWebKit.QGraphicsWebView.setRenderHint(arg__1[, enabled=true])
Parameters:
  • arg__1PySide.QtGui.QPainter.RenderHint
  • enabledPySide.QtCore.bool
PySide.QtWebKit.QGraphicsWebView.setRenderHints(arg__1)
Parameters:arg__1PySide.QtGui.QPainter.RenderHints
PySide.QtWebKit.QGraphicsWebView.setResizesToContents(enabled)
Parameters:enabledPySide.QtCore.bool

This property holds whether the size of the PySide.QtWebKit.QGraphicsWebView and its viewport changes to match the contents size.

If this property is set, the PySide.QtWebKit.QGraphicsWebView will automatically change its size to match the size of the main frame contents. As a result the top level frame will never have scrollbars. It will also make CSS fixed positioning to behave like absolute positioning with elements positioned relative to the document instead of the viewport.

This property should be used in conjunction with the QWebPage.preferredContentsSize property. If not explicitly set, the preferredContentsSize is automatically set to a reasonable value.

PySide.QtWebKit.QGraphicsWebView.setTiledBackingStoreFrozen(frozen)
Parameters:frozenPySide.QtCore.bool

This property holds whether the tiled backing store updates its contents.

If the tiled backing store is enabled using QWebSettings.TiledBackingStoreEnabled attribute, this property can be used to disable backing store updates temporarily. This can be useful for example for running a smooth animation that changes the scale of the PySide.QtWebKit.QGraphicsWebView .

When the backing store is unfrozen, its contents will be automatically updated to match the current state of the document. If the PySide.QtWebKit.QGraphicsWebView scale was changed, the backing store is also re-rendered using the new scale.

If the tiled backing store is not enabled, this property does nothing.

See also

QWebSettings.TiledBackingStoreEnabled QGraphicsObject.scale

PySide.QtWebKit.QGraphicsWebView.setUrl(arg__1)
Parameters:arg__1PySide.QtCore.QUrl

This property holds the url of the web page currently viewed.

Setting this property clears the view and loads the URL.

By default, this property contains an empty, invalid URL.

PySide.QtWebKit.QGraphicsWebView.setZoomFactor(arg__1)
Parameters:arg__1PySide.QtCore.qreal

This property holds the zoom factor for the view.

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

Returns a pointer to the view/page specific settings object.

It is equivalent to

view.page().settings()
PySide.QtWebKit.QGraphicsWebView.statusBarMessage(message)
Parameters:message – unicode
PySide.QtWebKit.QGraphicsWebView.stop()

Convenience slot that stops loading the document.

PySide.QtWebKit.QGraphicsWebView.title()
Return type:unicode

This property holds the title of the web page currently viewed.

By default, this property contains an empty string.

PySide.QtWebKit.QGraphicsWebView.titleChanged(arg__1)
Parameters:arg__1 – unicode
PySide.QtWebKit.QGraphicsWebView.triggerPageAction(action[, checked=false])
Parameters:
PySide.QtWebKit.QGraphicsWebView.url()
Return type:PySide.QtCore.QUrl

This property holds the url of the web page currently viewed.

Setting this property clears the view and loads the URL.

By default, this property contains an empty, invalid URL.

PySide.QtWebKit.QGraphicsWebView.urlChanged(arg__1)
Parameters:arg__1PySide.QtCore.QUrl
PySide.QtWebKit.QGraphicsWebView.zoomFactor()
Return type:PySide.QtCore.qreal

This property holds the zoom factor for the view.