QWebPluginFactory Class Reference

#include <mw/QtWebKit/qwebpluginfactory.h>

class QWebPluginFactory : public QObject, public QObject

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

Inherits from

  • QWebPluginFactory
    Public Member Functions
    QWebPluginFactory(QObject *)
    virtual ~QWebPluginFactory()
    pure virtual QObject *create(const QString &, const QUrl &, const QStringList &, const QStringList &)
    virtual boolextension(Extension, const ExtensionOption *, ExtensionReturn *)
    pure virtual QList< Plugin >plugins()
    virtual voidrefreshPlugins()
    virtual boolsupportsExtension(Extension)
    Inherited Attributes
    Inherited Functions
    QObject::QObject(QObjectPrivate &,QObject *)
    QObject::childEvent(QChildEvent *)
    QObject::connect(const QObject *,const QMetaMethod &,const QObject *,const QMetaMethod &,Qt::ConnectionType)
    QObject::connect(const QObject *,const char *,const QObject *,const char *,Qt::ConnectionType)
    QObject::connect(const QObject *,const char *,const char *,Qt::ConnectionType)const
    QObject::connectNotify(const char *)
    QObject::customEvent(QEvent *)
    QObject::disconnect(const QObject *,const QMetaMethod &,const QObject *,const QMetaMethod &)
    QObject::disconnect(const QObject *,const char *)
    QObject::disconnect(const QObject *,const char *,const QObject *,const char *)
    QObject::disconnect(const char *,const QObject *,const char *)
    QObject::disconnectNotify(const char *)
    QObject::event(QEvent *)
    QObject::eventFilter(QObject *,QEvent *)
    QObject::findChild(const QString &)const
    QObject::findChildren(const QRegExp &)const
    QObject::findChildren(const QString &)const
    QObject::inherits(const char *)const
    QObject::installEventFilter(QObject *)
    QObject::moveToThread(QThread *)
    QObject::property(const char *)const
    QObject::receivers(const char *)const
    QObject::removeEventFilter(QObject *)
    QObject::setObjectName(const QString &)
    QObject::setParent(QObject *)
    QObject::setProperty(const char *,const QVariant &)
    QObject::setUserData(uint,QObjectUserData *)
    QObject::timerEvent(QTimerEvent *)

    Detailed Description

    4.4 QtWebKit
    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.

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


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

    You provide a QWebPluginFactory by implementing the plugins() and the create() methods. For 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.

    The 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 QObject, but currently only plugins based on either QWidget or QGraphicsWidget are supported.

    Constructor & Destructor Documentation

    QWebPluginFactory ( QObject * )

    QWebPluginFactory(QObject *parent = 0)[explicit]


    The full name of the MIME type; e.g., {text/plain} or {image/png}.

    QWebPluginFactory::MimeType::description The description of the mime type.

    QWebPluginFactory::MimeType::fileExtensions The list of file extensions that are used by this mime type.

    For example, a mime type for PDF documents would return "pdf" as its file extension.

    Constructs a QWebPluginFactory with parent parent.

    ~QWebPluginFactory ( )



    Member Function Documentation

    create ( const QString &, const QUrl &, const QStringList &, const QStringList & )

    QObject *create(const QString &mimeType,
    const QUrl &,
    const QStringList &argumentNames,
    const QStringList &argumentValues
    )const [pure virtual]

    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 QWidget.

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

    For example:

        <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" />

    The above object element will result in a call to create() with the following arguments: Parameter Value 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.

    extension ( Extension, const ExtensionOption *, ExtensionReturn * )

    const ExtensionOption *option = 0,
    ExtensionReturn *output = 0

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

    plugins ( )

    QList< Plugin >plugins()const [pure virtual]

    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 objects.

    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.

    supportsExtension ( Extension )

    boolsupportsExtension(Extensionextension)const [virtual]

    This virtual function returns true if the plugin factory supports extension; otherwise false is returned.