QGraphicsWebView Class Reference

[QtWebKit module]

该QGraphicsWebView类允许Web内容被添加到一个GraphicsViewMore…

继承QGraphicsWidget

Methods

  • __init__ (self, QGraphicsItem parent = None)
  • back (self)
  • contextMenuEvent (self, QGraphicsSceneContextMenuEvent)
  • dragEnterEvent (self, QGraphicsSceneDragDropEvent)
  • dragLeaveEvent (self, QGraphicsSceneDragDropEvent)
  • dragMoveEvent (self, QGraphicsSceneDragDropEvent)
  • dropEvent (self, QGraphicsSceneDragDropEvent)
  • bool event (self, QEvent)
  • bool findText (self, QString subString, QWebPage.FindFlags options = 0)
  • focusInEvent (self, QFocusEvent)
  • bool focusNextPrevChild (self, bool next)
  • focusOutEvent (self, QFocusEvent)
  • forward (self)
  • QWebHistory history (self)
  • hoverLeaveEvent (self, QGraphicsSceneHoverEvent)
  • hoverMoveEvent (self, QGraphicsSceneHoverEvent)
  • QIcon icon (self)
  • inputMethodEvent (self, QInputMethodEvent)
  • QVariant inputMethodQuery (self, Qt.InputMethodQuery query)
  • bool isModified (self)
  • bool isTiledBackingStoreFrozen (self)
  • QVariant itemChange (self, QGraphicsItem.GraphicsItemChange change, QVariant value)
  • keyPressEvent (self, QKeyEvent)
  • keyReleaseEvent (self, QKeyEvent)
  • load (self, QUrl url)
  • load (self, QNetworkRequest request, QNetworkAccessManager.Operation operation = QNetworkAccessManager.GetOperation, QByteArray body = QByteArray())
  • mouseDoubleClickEvent (self, QGraphicsSceneMouseEvent)
  • mouseMoveEvent (self, QGraphicsSceneMouseEvent)
  • mousePressEvent (self, QGraphicsSceneMouseEvent)
  • mouseReleaseEvent (self, QGraphicsSceneMouseEvent)
  • QWebPage page (self)
  • QAction pageAction (self, QWebPage.WebAction action)
  • paint (self, QPainter painter, QStyleOptionGraphicsItem option, QWidget widget = None)
  • reload (self)
  • QPainter.RenderHints renderHints (self)
  • bool resizesToContents (self)
  • bool sceneEvent (self, QEvent)
  • setContent (self, QByteArray data, QString mimeType = QString(), QUrl baseUrl = QUrl())
  • setGeometry (self, QRectF rect)
  • setHtml (self, QString html, QUrl baseUrl = QUrl())
  • setPage (self, QWebPage)
  • setRenderHint (self, QPainter.RenderHint hint, bool enabled = True)
  • setRenderHints (self, QPainter.RenderHints hints)
  • setResizesToContents (self, bool enabled)
  • setTiledBackingStoreFrozen (self, bool frozen)
  • QWebSettings settings (self)
  • setUrl (self, QUrl)
  • setZoomFactor (self, float)
  • QSizeF sizeHint (self, Qt.SizeHint which, QSizeF constraint)
  • stop (self)
  • QString title (self)
  • triggerPageAction (self, QWebPage.WebAction action, bool checked = False)
  • updateGeometry (self)
  • QUrl url (self)
  • wheelEvent (self, QGraphicsSceneWheelEvent)
  • float zoomFactor (self)

Qt Signals

  • void iconChanged ()
  • void linkClicked (const QUrl&)
  • void loadFinished (bool)
  • void loadProgress (int)
  • void loadStarted ()
  • void statusBarMessage (const QString&)
  • void titleChanged (const QString&)
  • void urlChanged (const QUrl&)

Detailed Description

该QGraphicsWebView类允许Web内容被添加到一个GraphicsView

这个类的一个实例呈现从URL网页内容或提供的数据,使用的功能QtWebKit模块。

如果该项目的宽度和高度都没有设置,它们将默认为800和600 ,分别为。如果网页内容比越大,滚动条,如果没有明确禁止将被显示。

Browser Features

许多所提供的功能,信号和属性QWebView也可用于这一项目,使其成为简单,适应现有的代码使用QGraphicsWebView代替QWebView

该项目采用的是QWebPage反对执行Web内容的呈现,这样就可以用得到page()函数,使文档本身进行访问和修改。

QWebView使用项目记录浏览历史记录QWebHistory对象,访问使用history()函数。该QWebSettings对象,定义了浏览器的配置可以用以下方式获得settings( )函数,使像插件支持自定义每个项目的功能。


Method Documentation

  1. QGraphicsWebView.__init__ (self, QGraphicsItem parent = None)

parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。

构造一个空QGraphicsWebView与父parent

See also load( ) 。

  1. QGraphicsWebView.back (self)

这种方法也是一个Qt槽与C + +的签名void back()

便利插槽加载以前的文档中通过导航链接建立文件清单。什么都不做,如果没有以前的文档。

See also forward( ) 。

  1. QGraphicsWebView.contextMenuEvent (self, QGraphicsSceneContextMenuEvent)

从重新实现QGraphicsItem.contextMenuEvent( ) 。

  1. QGraphicsWebView.dragEnterEvent (self, QGraphicsSceneDragDropEvent)

从重新实现QGraphicsItem.dragEnterEvent( ) 。

  1. QGraphicsWebView.dragLeaveEvent (self, QGraphicsSceneDragDropEvent)

从重新实现QGraphicsItem.dragLeaveEvent( ) 。

  1. QGraphicsWebView.dragMoveEvent (self, QGraphicsSceneDragDropEvent)

从重新实现QGraphicsItem.dragMoveEvent( ) 。

  1. QGraphicsWebView.dropEvent (self, QGraphicsSceneDragDropEvent)

从重新实现QGraphicsItem.dropEvent( ) 。

  1. bool QGraphicsWebView.event (self, QEvent)

从重新实现QObject.event( ) 。

  1. bool QGraphicsWebView.findText (self, QString subString, QWebPage.FindFlags options = 0)

查找指定的字符串,subString在该页面中,使用给定的options

如果HighlightAllOccurrences标志传递,函数将突出存在于页面中的所有事件。所有后续调用将延长的亮点,而不是取代它,以出现新的字符串。

如果HighlightAllOccurrences标志不通过,该函数将选择的发生,所有后续调用将取代目前出现的下一个。

要清除选择,只传递一个空字符串。

返回True如果subString结果发现,否则返回False 。

See also QWebPage.selectedText()和QWebPage.selectionChanged( ) 。

  1. QGraphicsWebView.focusInEvent (self, QFocusEvent)

从重新实现QGraphicsItem.focusInEvent( ) 。

  1. bool QGraphicsWebView.focusNextPrevChild (self, bool next)

从重新实现QGraphicsWidget.focusNextPrevChild( ) 。

  1. QGraphicsWebView.focusOutEvent (self, QFocusEvent)

从重新实现QGraphicsItem.focusOutEvent( ) 。

  1. QGraphicsWebView.forward (self)

这种方法也是一个Qt槽与C + +的签名void forward()

便利插槽,加载下一个文档中通过导航链接建立文件清单。什么都不做,如果没有下一个文件。

See also back( ) 。

  1. QWebHistory QGraphicsWebView.history (self)

[

返回一个指针,指向的导航网页视图的历史。

它相当于

  1. view->page()->history();
  1. QGraphicsWebView.hoverLeaveEvent (self, QGraphicsSceneHoverEvent)

]($docs-qwebhistory.html)

从重新实现QGraphicsItem.hoverLeaveEvent( ) 。

  1. QGraphicsWebView.hoverMoveEvent (self, QGraphicsSceneHoverEvent)

从重新实现QGraphicsItem.hoverMoveEvent( ) 。

  1. QIcon QGraphicsWebView.icon (self)

[

  1. QGraphicsWebView.inputMethodEvent (self, QInputMethodEvent)

]($docs-qicon.html)

从重新实现QGraphicsItem.inputMethodEvent( ) 。

  1. QVariant QGraphicsWebView.inputMethodQuery (self, Qt.InputMethodQuery query)

从重新实现QGraphicsItem.inputMethodQuery( ) 。

  1. bool QGraphicsWebView.isModified (self)
  1. bool QGraphicsWebView.isTiledBackingStoreFrozen (self)
  1. QVariant QGraphicsWebView.itemChange (self, QGraphicsItem.GraphicsItemChange change, QVariant value)

从重新实现QGraphicsItem.itemChange( ) 。

  1. QGraphicsWebView.keyPressEvent (self, QKeyEvent)

从重新实现QGraphicsItem.keyPressEvent( ) 。

  1. QGraphicsWebView.keyReleaseEvent (self, QKeyEvent)

从重新实现QGraphicsItem.keyReleaseEvent( ) 。

  1. QGraphicsWebView.load (self, QUrl url)

指定的负载url并显示它。

Note:该视图保持不变,直到足够的数据已经到达,以显示新url

See also setUrl( )url()和urlChanged( ) 。

  1. QGraphicsWebView.load (self, QNetworkRequest request, QNetworkAccessManager.Operation operation = QNetworkAccessManager.GetOperation, QByteArray body = QByteArray())

加载一个网络请求,request使用中规定的方法operation

body是可选的,并且仅用于POST操作。

Note:该视图保持不变,直到足够的数据已经到达,以显示新的URL。

See also url()和urlChanged( ) 。

  1. QGraphicsWebView.mouseDoubleClickEvent (self, QGraphicsSceneMouseEvent)

从重新实现QGraphicsItem.mouseDoubleClickEvent( ) 。

  1. QGraphicsWebView.mouseMoveEvent (self, QGraphicsSceneMouseEvent)

从重新实现QGraphicsItem.mouseMoveEvent( ) 。

  1. QGraphicsWebView.mousePressEvent (self, QGraphicsSceneMouseEvent)

从重新实现QGraphicsItem.mousePressEvent( ) 。

  1. QGraphicsWebView.mouseReleaseEvent (self, QGraphicsSceneMouseEvent)

从重新实现QGraphicsItem.mouseReleaseEvent( ) 。

  1. QWebPage QGraphicsWebView.page (self)

[

返回一个指针,指向底层的网页。

]($docs-qwebpage.html)

See also setPage( ) 。

  1. QAction QGraphicsWebView.pageAction (self, QWebPage.WebAction action)

返回一个指针,指向一个QAction封装指定网络行动action

  1. QGraphicsWebView.paint (self, QPainter painter, QStyleOptionGraphicsItem option, QWidget widget = None)

从重新实现QGraphicsItem.paint( ) 。

  1. QGraphicsWebView.reload (self)

这种方法也是一个Qt槽与C + +的签名void reload()

重新加载当前文档。

See also stop()和loadStarted( ) 。

  1. QPainter.RenderHints QGraphicsWebView.renderHints (self)

[

  1. bool QGraphicsWebView.resizesToContents (self)
  1. bool QGraphicsWebView.sceneEvent (self, QEvent)

]($docs-index.htm)

从重新实现QGraphicsItem.sceneEvent( ) 。

  1. QGraphicsWebView.setContent (self, QByteArray data, QString mimeType = QString(), QUrl baseUrl = QUrl())

设置捲筒纸graphicsitem的内容以指定的内容data。如果mimeType参数为空它是目前假设内容是HTML,但在未来的版本中,我们可能会引入自动检测。

在内容引用的外部对象的位置相对baseUrl

data立即加载;外部对象异步加载。

See also load( )setHtml()和QWebFrame.toHtml( ) 。

  1. QGraphicsWebView.setGeometry (self, QRectF rect)

从重新实现QGraphicsLayoutItem.setGeometry( ) 。

  1. QGraphicsWebView.setHtml (self, QString html, QUrl baseUrl = QUrl())

设置Web视图的内容的指定html

外部对象,如样式表或HTML文档中引用的图片的位置相对于baseUrl

html立即加载;外部对象异步加载。

使用此方法时, WebKit的假定外部资源,例如JavaScript程序或样式表,除非另有规定被编码为UTF -8 。例如,外部脚本的编码可以通过HTML脚本标记的charset属性来指定。备选地,编码也可以由Web服务器指定。

这相当于一个方便的功能,使用setContent ( HTML , “为text / html ” , baseURL即可) 。

Warning:此功能仅用于HTML ,为其他MIME类型(即XHTML , SVG )setContent( )应该使用。

See also load( )setContent( )QWebFrame.toHtml()和QWebFrame.setContent( ) 。

  1. QGraphicsWebView.setPage (self, QWebPage)

品牌page网页graphicsitem的新网页。

QObject该页面提供的仍然是对象的所有者。如果当前文档是Web视图的孩子,它会被删除。

See also page( ) 。

  1. QGraphicsWebView.setRenderHint (self, QPainter.RenderHint hint, bool enabled = True)

If enabled诚然,启用指定的渲染hint否则禁用它。

此功能被引入Qt的4.8 。

See also renderHintsQPainter.renderHints( ) 。

  1. QGraphicsWebView.setRenderHints (self, QPainter.RenderHints hints)
  1. QGraphicsWebView.setResizesToContents (self, bool enabled)
  1. QGraphicsWebView.setTiledBackingStoreFrozen (self, bool frozen)
  1. QWebSettings QGraphicsWebView.settings (self)

[

返回一个指针,指向视图/页面设置特定对象。

它相当于

  1. view->page()->settings();

]($docs-qwebsettings.html)

See also QWebSettings.globalSettings( ) 。

  1. QGraphicsWebView.setUrl (self, QUrl)
  1. QGraphicsWebView.setZoomFactor (self, float)
  1. QSizeF QGraphicsWebView.sizeHint (self, Qt.SizeHint which, QSizeF constraint)

从重新实现QGraphicsLayoutItem.sizeHint( ) 。

  1. QGraphicsWebView.stop (self)

这种方法也是一个Qt槽与C + +的签名void stop()

便利插槽,停止加载该文件。

See also reload()和loadFinished( ) 。

  1. QString QGraphicsWebView.title (self)
  1. QGraphicsWebView.triggerPageAction (self, QWebPage.WebAction action, bool checked = False)

触发指定的action。如果是指定了辨认的动作checked假定状态。

See also pageAction( ) 。

  1. QGraphicsWebView.updateGeometry (self)

从重新实现QGraphicsLayoutItem.updateGeometry( ) 。

  1. QUrl QGraphicsWebView.url (self)

[

  1. QGraphicsWebView.wheelEvent (self, QGraphicsSceneWheelEvent)

]($docs-qurl.html)

从重新实现QGraphicsItem.wheelEvent( ) 。

  1. float QGraphicsWebView.zoomFactor (self)

Qt Signal Documentation

  1. void iconChanged ()

这是该信号的默认超载。

这个信号时页面的图标被加载或改变被发射。

为了让图标加载,则需要使用设置一个图标数据库路径QWebSettings.setIconDatabasePath( ) 。

See also icon()和QWebSettings.setIconDatabasePath( ) 。

  1. void linkClicked (const QUrl&)

这是该信号的默认超载。

每当用户点击一个链接这个信号被发射以及页面的linkDelegationPolicy属性设置为处理委讬给指定的链接url

See also QWebPage.linkDelegationPolicy( ) 。

  1. void loadFinished (bool)

这是该信号的默认超载。

当页面的加载完成时,这个信号被发射。ok将指示负载是否成功,或发生任何错误。

See also loadStarted( ) 。

  1. void loadProgress (int)

这是该信号的默认超载。

每个网页中的元素完成加载和整体加载进度前进时,这个信号被发射。

这个信号可以跟踪所有子帧的进展。

电流值是由所提供progress和秤从0到100 ,这是默认范围QProgressBar

See also loadStarted()和loadFinished( ) 。

  1. void loadStarted ()

这是该信号的默认超载。

当开始页面的新负载,这个信号被发射。

See also loadProgress()和loadFinished( ) 。

  1. void statusBarMessage (const QString&)

这是该信号的默认超载。

这个信号被发射时,状态栏text由页改变。

  1. void titleChanged (const QString&)

这是该信号的默认超载。

这个信号被发射时的title的主框架的改变。

See also title( ) 。

  1. void urlChanged (const QUrl&)

这是该信号的默认超载。

这个信号被发射时的url的观点变化。

See also url()和load( ) 。