• PySide 模块
  • PySide.QtWebKit
  • 内容表

    上一话题

    QWebSettings

    下一话题

    QWebPluginFactory.MimeType

    QWebPluginFactory

    详细描述

    PySide.QtWebKit.QWebPluginFactory class is used to embed custom data types in web pages.

    The HTML <object> tag is used to embed arbitrary content into a web page, for example:

    <object type="application/x-pdf" data="http://qt.nokia.com/document.pdf" width="500" height="400"></object>
    									

    QtWebkit will natively handle the most basic data types like text/html and image/jpeg , but for any advanced or custom data types you will need to provide a handler yourself.

    PySide.QtWebKit.QWebPluginFactory is a factory for creating plugins for PySide.QtWebKit.QWebPage , where each plugin provides support for one or more data types. A plugin factory can be installed on a PySide.QtWebKit.QWebPage 使用 QWebPage.setPluginFactory() .

    注意

    The plugin factory is only used if plugins are enabled through PySide.QtWebKit.QWebSettings .

    You provide a PySide.QtWebKit.QWebPluginFactory by implementing the PySide.QtWebKit.QWebPluginFactory.plugins() PySide.QtWebKit.QWebPluginFactory.create() methods. For PySide.QtWebKit.QWebPluginFactory.plugins() it is necessary to describe the plugins the factory can create, including a description and the supported MIME types. The MIME types each plugin can handle should match the ones specified in in the HTML <object> tag of your content.

    PySide.QtWebKit.QWebPluginFactory.create() method is called if the requested MIME type is supported. The implementation has to return a new instance of the plugin requested for the given MIME type and the specified URL.

    The plugins themselves are subclasses of PySide.QtCore.QObject , but currently only plugins based on either PySide.QtGui.QWidget or PySide.QtGui.QGraphicsWidget are supported.

    class PySide.QtWebKit. QWebPluginFactory ( [ parent=None ] )
    参数: parent PySide.QtCore.QObject

    构造 PySide.QtWebKit.QWebPluginFactory 采用父级 parent .

    PySide.QtWebKit.QWebPluginFactory. Extension

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

    Currently there are no extensions.

    PySide.QtWebKit.QWebPluginFactory. create ( mimeType , arg__2 , argumentNames , argumentValues )
    参数:
    • mimeType – unicode
    • arg__2 PySide.QtCore.QUrl
    • argumentNames – list of strings
    • argumentValues – list of strings
    返回类型:

    PySide.QtCore.QObject

    Implemented in subclasses to create a new plugin that can display content of the MIME type given by mimeType . The URL of the content is provided in url . The returned object should be a PySide.QtGui.QWidget .

    The HTML object element can provide parameters through the <param> tag. The name and the value attributes of these tags are specified by the argumentNames and argumentValues string lists.

    例如:

    <object type="application/x-pdf" data="http://qt.nokia.com/document.pdf" width="500" height="400">
        <param name="showTableOfContents" value="true" />
        <param name="hideThumbnails" value="false" />
    </object>
    										

    The above object element will result in a call to PySide.QtWebKit.QWebPluginFactory.create() with the following arguments:

    Parameter
    mimeType “application/x-pdf”
    url http://qt.nokia.com/document.pdf
    argumentNames “showTableOfContents” “hideThumbnails”
    argumentVaues “true” “false”

    注意

    Ownership of the returned object will be transferred to the caller.

    PySide.QtWebKit.QWebPluginFactory. plugins ( )
    返回类型:

    This function is reimplemented in subclasses to return a list of supported plugins the factory can create.

    注意

    Currently, this function is only called when JavaScript programs access the global plugins or mimetypes 对象。

    PySide.QtWebKit.QWebPluginFactory. refreshPlugins ( )

    This function is called to refresh the list of supported plugins. It may be called after a new plugin has been installed in the system.

    PySide.QtWebKit.QWebPluginFactory. supportsExtension ( extension )
    参数: extension PySide.QtWebKit.QWebPluginFactory.Extension
    返回类型: PySide.QtCore.bool

    This virtual function returns true if the plugin factory supports extension ;否则 false 被返回。

    另请参阅

    extension()