<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qwebpluginfactory.cpp --> <title>QWebPluginFactory Class | QtWebKit 5.2</title> <link rel="stylesheet" type="text/css" href="style/offline.css" /> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <ul> <li><a href="../qtdoc/index.html">Qt 5.2</a></li> <li>QWebPluginFactory</li> <li id="buildversion"> Qt 5.2.1 Reference Documentation</li> </ul> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-types">Public Types</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <h1 class="title">QWebPluginFactory Class</h1> <!-- $$$QWebPluginFactory-brief --> <p>The QWebPluginFactory class is used to embed custom data types in web pages. <a href="#details">More...</a></p> <!-- @@@QWebPluginFactory --> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> </b><tt><span class="preprocessor">#include <QWebPluginFactory></span> </tt></td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 4.4</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qobject.html">QObject</a>.</td></tr></table><ul> <li><a href="qwebpluginfactory-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-types"></a> <h2>Public Types</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="qwebpluginfactory-mimetype.html">MimeType</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="qwebpluginfactory-plugin.html">Plugin</a></b></td></tr> </table> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qwebpluginfactory.html#QWebPluginFactory">QWebPluginFactory</a></b>(QObject *<i> parent</i> = 0)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qwebpluginfactory.html#dtor.QWebPluginFactory">~QWebPluginFactory</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QObject * </td><td class="memItemRight bottomAlign"><b><a href="qwebpluginfactory.html#create">create</a></b>(const QString &<i> mimeType</i>, const QUrl &<i> url</i>, const QStringList &<i> argumentNames</i>, const QStringList &<i> argumentValues</i>) const = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QList<Plugin> </td><td class="memItemRight bottomAlign"><b><a href="qwebpluginfactory.html#plugins">plugins</a></b>() const = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qwebpluginfactory.html#refreshPlugins">refreshPlugins</a></b>()</td></tr> </table> <ul> <li class="fn">31 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li> <li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li> <li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li> <li class="fn">1 public variable inherited from <a href="../qtcore/qobject.html#public-variables">QObject</a></li> <li class="fn">10 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li> <li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li> <li class="fn">2 protected variables inherited from <a href="../qtcore/qobject.html#protected-variables">QObject</a></li> </ul> <a name="details"></a> <!-- $$$QWebPluginFactory-description --> <div class="descr"> <h2>Detailed Description</h2> <p>The QWebPluginFactory class is used to embed custom data types in web pages.</p> <p>The HTML <tt><object></tt> tag is used to embed arbitrary content into a web page, for example:</p> <pre class="cpp"><span class="operator"><</span>object type<span class="operator">=</span><span class="string">"application/x-pdf"</span> data<span class="operator">=</span><span class="string">"http://qt.nokia.com/document.pdf"</span> width<span class="operator">=</span><span class="string">"500"</span> height<span class="operator">=</span><span class="string">"400"</span><span class="operator">></span><span class="operator"><</span><span class="operator">/</span>object<span class="operator">></span></pre> <p>Qt WebKit will natively handle the most basic data types like <tt>text/html</tt> and <tt>image/jpeg</tt>, but for any advanced or custom data types you will need to provide a handler yourself.</p> <p>QWebPluginFactory is a factory for creating plugins for <a href="qwebpage.html">QWebPage</a>, where each plugin provides support for one or more data types. A plugin factory can be installed on a <a href="qwebpage.html">QWebPage</a> using <a href="qwebpage.html#setPluginFactory">QWebPage::setPluginFactory</a>().</p> <p><b>Note: </b>The plugin factory is only used if plugins are enabled through <a href="qwebsettings.html">QWebSettings</a>.</p><p>You provide a QWebPluginFactory by implementing the <a href="qwebpluginfactory.html#plugins">plugins</a>() and the <a href="qwebpluginfactory.html#create">create</a>() methods. For <a href="qwebpluginfactory.html#plugins">plugins</a>() 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 <tt><object></tt> tag of your content.</p> <p>The <a href="qwebpluginfactory.html#create">create</a>() 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.</p> <p>The plugins themselves are subclasses of <a href="../qtcore/qobject.html">QObject</a>, but currently only plugins based on either <a href="../qtwidgets/qwidget.html">QWidget</a> or <a href="../qtwidgets/qgraphicswidget.html">QGraphicsWidget</a> are supported.</p> </div> <!-- @@@QWebPluginFactory --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QWebPluginFactory[overload1]$$$QWebPluginFactoryQObject* --> <h3 class="fn"><a name="QWebPluginFactory"></a>QWebPluginFactory::<span class="name">QWebPluginFactory</span>(<span class="type"><a href="../qtcore/qobject.html">QObject</a></span> *<i> parent</i> = 0)</h3> <p>Constructs a <a href="qwebpluginfactory.html">QWebPluginFactory</a> with parent <i>parent</i>.</p> <!-- @@@QWebPluginFactory --> <!-- $$$~QWebPluginFactory[overload1]$$$~QWebPluginFactory --> <h3 class="fn"><a name="dtor.QWebPluginFactory"></a>QWebPluginFactory::<span class="name">~QWebPluginFactory</span>()<tt> [virtual]</tt></h3> <p>Destructor.</p> <!-- @@@~QWebPluginFactory --> <!-- $$$create[overload1]$$$createconstQString&constQUrl&constQStringList&constQStringList& --> <h3 class="fn"><a name="create"></a><span class="type"><a href="../qtcore/qobject.html">QObject</a></span> * QWebPluginFactory::<span class="name">create</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i> mimeType</i>, const <span class="type"><a href="../qtcore/qurl.html">QUrl</a></span> &<i> url</i>, const <span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> &<i> argumentNames</i>, const <span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> &<i> argumentValues</i>) const<tt> [pure virtual]</tt></h3> <p>Implemented in subclasses to create a new plugin that can display content of the MIME type given by <i>mimeType</i>. The URL of the content is provided in <i>url</i>. The returned object should be a <a href="../qtwidgets/qwidget.html">QWidget</a>.</p> <p>The HTML object element can provide parameters through the <tt><param></tt> tag. The name and the value attributes of these tags are specified by the <i>argumentNames</i> and <i>argumentValues</i> string lists.</p> <p>For example:</p> <pre class="cpp"><span class="operator"><</span>object type<span class="operator">=</span><span class="string">"application/x-pdf"</span> data<span class="operator">=</span><span class="string">"http://qt.nokia.com/document.pdf"</span> width<span class="operator">=</span><span class="string">"500"</span> height<span class="operator">=</span><span class="string">"400"</span><span class="operator">></span> <span class="operator"><</span>param name<span class="operator">=</span><span class="string">"showTableOfContents"</span> value<span class="operator">=</span><span class="string">"true"</span> <span class="operator">/</span><span class="operator">></span> <span class="operator"><</span>param name<span class="operator">=</span><span class="string">"hideThumbnails"</span> value<span class="operator">=</span><span class="string">"false"</span> <span class="operator">/</span><span class="operator">></span> <span class="operator"><</span><span class="operator">/</span>object<span class="operator">></span></pre> <p>The above object element will result in a call to create() with the following arguments:</p> <table class="generic"> <thead><tr class="qt-style"><th >Parameter</th><th >Value</th></tr></thead> <tr valign="top" class="odd"><td >mimeType</td><td >"application/x-pdf"</td></tr> <tr valign="top" class="even"><td >url</td><td >"http://qt.nokia.com/document.pdf"</td></tr> <tr valign="top" class="odd"><td >argumentNames</td><td >"showTableOfContents" "hideThumbnails"</td></tr> <tr valign="top" class="even"><td >argumentVaues</td><td >"true" "false"</td></tr> </table> <p><b>Note: </b>Ownership of the returned object will be transferred to the caller.</p><!-- @@@create --> <!-- $$$plugins[overload1]$$$plugins --> <h3 class="fn"><a name="plugins"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span><<span class="type"><a href="qwebpluginfactory-plugin.html">Plugin</a></span>> QWebPluginFactory::<span class="name">plugins</span>() const<tt> [pure virtual]</tt></h3> <p>This function is reimplemented in subclasses to return a list of supported plugins the factory can create.</p> <p><b>Note: </b>Currently, this function is only called when JavaScript programs access the global <tt>plugins</tt> or <tt>mimetypes</tt> objects.</p><!-- @@@plugins --> <!-- $$$refreshPlugins[overload1]$$$refreshPlugins --> <h3 class="fn"><a name="refreshPlugins"></a><span class="type">void</span> QWebPluginFactory::<span class="name">refreshPlugins</span>()<tt> [virtual]</tt></h3> <p>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.</p> <!-- @@@refreshPlugins --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its subsidiaries. Documentation contributions included herein are the copyrights of their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>