<?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" lang="en_US" xml:lang="en_US"> <head> <title>kparts: KParts::ComponentFactory Namespace Reference (kparts)</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline DE v2.0" l gen true for "http://www.kde.org" r (nz 1 vz 1 lz 1 oz 1 cb 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.kde.org" r (n 0 s 0 v 0 l 0))' /> <meta name="trademark" content="KDE e.V." /> <meta name="description" content="K Desktop Environment Homepage, KDE.org" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="robots" content="all" /> <link rel="shortcut icon" href="../../favicon.ico" /> <link rel="stylesheet" media="screen" type="text/css" title="APIDOX" href="doxygen.css" /> </head> <body> <div id="nav_header_top" align="right"> <a href="#content" class="doNotDisplay" accesskey="2">Skip to main content ::</a> <a href="../.."><img id="nav_header_logo" alt="Home" align="left" src="../../kde_gear_64.png" border="0" /></a> <span class="doNotDisplay">::</span> <div id="nav_header_title" align="left">KDE API Reference</div> </div> <div id="nav_header_bottom" align="right"> <span class="doNotDisplay">:: <a href="#navigation" accesskey="5">Skip to Link Menu</a><br/></span> <div id="nav_header_bottom_right" style="text-align: left;"> / <a href="../..">API Reference</a> / <a href=".">kparts</a> </div> </div> <table id="main" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td valign="top" class="menuheader" height="0"></td> <td id="contentcolumn" valign="top" rowspan="2" > <div id="content" style="padding-top: 0px;"><div style="width:100%; margin: 0px; padding: 0px;"> <a name="content"></a> <!-- Generated by Doxygen 1.4.7 --> <div class="nav"> <a class="el" href="namespaceKParts.html">KParts</a>::<a class="el" href="namespaceKParts_1_1ComponentFactory.html">ComponentFactory</a></div> <h1>KParts::ComponentFactory Namespace Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2> Namespace for <a class="el" href="namespaceKParts.html">KParts</a> components. <p> <p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Enumerations</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceKParts_1_1ComponentFactory.html#a0f34004323782d3721aea693a7e9bfb">ComponentLoadingError</a> { <br> <b>ErrNoServiceFound</b> = 1, <b>ErrServiceProvidesNoLibrary</b>, <b>ErrNoLibrary</b>, <b>ErrNoFactory</b>, <br> <b>ErrNoComponent</b> <br> }</td></tr> <tr><td colspan="2"><br><h2>Functions</h2></td></tr> <tr><td class="memTemplParams" nowrap colspan="2">template<class T> </td></tr> <tr><td class="memTemplItemLeft" nowrap align="right" valign="top">static T * </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceKParts_1_1ComponentFactory.html#ea3f2ee59e87ce6476f0a9bd656807ea">createInstanceFromFactory</a> (<a class="elRef" doxygen="kdecore.tag:../../kdecore/html/" href="../../kdecore/html/classKLibFactory.html">KLibFactory</a> *factory, <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> *parent=0, const char *name=0, const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> &args=<a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>())</td></tr> <tr><td class="memTemplParams" nowrap colspan="2">template<class T> </td></tr> <tr><td class="memTemplItemLeft" nowrap align="right" valign="top">static T * </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceKParts_1_1ComponentFactory.html#51396dbf12d4fec7a6d23649e089161e">createPartInstanceFromFactory</a> (<a class="el" href="classKParts_1_1Factory.html">KParts::Factory</a> *factory, <a class="elRef" doxygen="qt.tag:" href="qwidget.html">QWidget</a> *parentWidget=0, const char *widgetName=0, <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> *parent=0, const char *name=0, const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> &args=<a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>())</td></tr> <tr><td class="memTemplParams" nowrap colspan="2">template<class T> </td></tr> <tr><td class="memTemplItemLeft" nowrap align="right" valign="top">static T * </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceKParts_1_1ComponentFactory.html#9fe4287abe37f168857ef6e1fb7621f4">createInstanceFromLibrary</a> (const char *libraryName, <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> *parent=0, const char *name=0, const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> &args=<a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>(), int *error=0)</td></tr> <tr><td class="memTemplParams" nowrap colspan="2"><a class="anchor" name="e055044d664b5e18c8d3215a2601c9f6"></a><!-- doxytag: member="KParts::ComponentFactory::createPartInstanceFromLibrary" ref="e055044d664b5e18c8d3215a2601c9f6" args="(const char *libraryName, QWidget *parentWidget=0, const char *widgetName=0, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0)" --> template<class T> </td></tr> <tr><td class="memTemplItemLeft" nowrap align="right" valign="top">static T * </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceKParts_1_1ComponentFactory.html#e055044d664b5e18c8d3215a2601c9f6">createPartInstanceFromLibrary</a> (const char *libraryName, <a class="elRef" doxygen="qt.tag:" href="qwidget.html">QWidget</a> *parentWidget=0, const char *widgetName=0, <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> *parent=0, const char *name=0, const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> &args=<a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>(), int *error=0)</td></tr> <tr><td class="memTemplParams" nowrap colspan="2"><a class="anchor" name="97853cd4de3b0451fced5278049db71f"></a><!-- doxytag: member="KParts::ComponentFactory::createInstanceFromService" ref="97853cd4de3b0451fced5278049db71f" args="(const KService::Ptr &service, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0)" --> template<class T> </td></tr> <tr><td class="memTemplItemLeft" nowrap align="right" valign="top">static T * </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceKParts_1_1ComponentFactory.html#97853cd4de3b0451fced5278049db71f">createInstanceFromService</a> (const KService::Ptr &service, <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> *parent=0, const char *name=0, const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> &args=<a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>(), int *error=0)</td></tr> <tr><td class="memTemplParams" nowrap colspan="2"><a class="anchor" name="b3a009f028368e3507e6ffef7b0bff8d"></a><!-- doxytag: member="KParts::ComponentFactory::createPartInstanceFromService" ref="b3a009f028368e3507e6ffef7b0bff8d" args="(const KService::Ptr &service, QWidget *parentWidget=0, const char *widgetName=0, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0)" --> template<class T> </td></tr> <tr><td class="memTemplItemLeft" nowrap align="right" valign="top">static T * </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceKParts_1_1ComponentFactory.html#b3a009f028368e3507e6ffef7b0bff8d">createPartInstanceFromService</a> (const KService::Ptr &service, <a class="elRef" doxygen="qt.tag:" href="qwidget.html">QWidget</a> *parentWidget=0, const char *widgetName=0, <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> *parent=0, const char *name=0, const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> &args=<a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>(), int *error=0)</td></tr> <tr><td class="memTemplParams" nowrap colspan="2"><a class="anchor" name="3ad061bac7167ab749094c9534dee6bd"></a><!-- doxytag: member="KParts::ComponentFactory::createInstanceFromServices" ref="3ad061bac7167ab749094c9534dee6bd" args="(ServiceIterator begin, ServiceIterator end, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0)" --> template<class T, class ServiceIterator> </td></tr> <tr><td class="memTemplItemLeft" nowrap align="right" valign="top">static T * </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceKParts_1_1ComponentFactory.html#3ad061bac7167ab749094c9534dee6bd">createInstanceFromServices</a> (ServiceIterator begin, ServiceIterator end, <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> *parent=0, const char *name=0, const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> &args=<a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>(), int *error=0)</td></tr> <tr><td class="memTemplParams" nowrap colspan="2"><a class="anchor" name="f44ec954d45ff06c66db833d9e64a0a7"></a><!-- doxytag: member="KParts::ComponentFactory::createPartInstanceFromServices" ref="f44ec954d45ff06c66db833d9e64a0a7" args="(ServiceIterator begin, ServiceIterator end, QWidget *parentWidget=0, const char *widgetName=0, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0)" --> template<class T, class ServiceIterator> </td></tr> <tr><td class="memTemplItemLeft" nowrap align="right" valign="top">static T * </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceKParts_1_1ComponentFactory.html#f44ec954d45ff06c66db833d9e64a0a7">createPartInstanceFromServices</a> (ServiceIterator begin, ServiceIterator end, <a class="elRef" doxygen="qt.tag:" href="qwidget.html">QWidget</a> *parentWidget=0, const char *widgetName=0, <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> *parent=0, const char *name=0, const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> &args=<a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>(), int *error=0)</td></tr> <tr><td class="memTemplParams" nowrap colspan="2">template<class T> </td></tr> <tr><td class="memTemplItemLeft" nowrap align="right" valign="top">static T * </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceKParts_1_1ComponentFactory.html#66a8538016585af5338d9578b116a918">createInstanceFromQuery</a> (const <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> &serviceType, const <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> &constraint=QString::null, <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> *parent=0, const char *name=0, const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> &args=<a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>(), int *error=0)</td></tr> <tr><td class="memTemplParams" nowrap colspan="2">template<class T> </td></tr> <tr><td class="memTemplItemLeft" nowrap align="right" valign="top">static T * </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceKParts_1_1ComponentFactory.html#0af2316c53e9d4dedfedecd1badc5e72">createPartInstanceFromQuery</a> (const <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> &serviceType, const <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> &constraint, <a class="elRef" doxygen="qt.tag:" href="qwidget.html">QWidget</a> *parentWidget=0, const char *widgetName=0, <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> *parent=0, const char *name=0, const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> &args=<a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>(), int *error=0)</td></tr> </table> <hr><h2>Enumeration Type Documentation</h2> <a class="anchor" name="a0f34004323782d3721aea693a7e9bfb"></a><!-- doxytag: member="KParts::ComponentFactory::ComponentLoadingError" ref="a0f34004323782d3721aea693a7e9bfb" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">enum <a class="el" href="namespaceKParts_1_1ComponentFactory.html#a0f34004323782d3721aea693a7e9bfb">KParts::ComponentFactory::ComponentLoadingError</a> </td> </tr> </table> </div> <div class="memdoc"> <p> This enum type defines the possible error cases that can happen when loading a component. <p> <ul> <li> <code>ErrNoServiceFound</code> - no service implementing the given mimetype and fullfilling the given constraint expression can be found. </li> <li> <code>ErrServiceProvidesNoLibrary</code> - the specified service provides no shared library </li> <li> <code>ErrNoLibrary</code> - the specified library could not be loaded. Use <a class="elRef" doxygen="kdecore.tag:../../kdecore/html/" href="../../kdecore/html/classKLibLoader.html#6b463bb7c1412ad12201b72944d4f85d">KLibLoader::lastErrorMessage</a> for details. </li> <li> <code>ErrNoFactory</code> - the library does not export a factory for creating components </li> <li> <code>ErrNoComponent</code> - the factory does not support creating components of the specified type </li> </ul> <p> Definition at line <a class="el" href="componentfactory_8h-source.html#l00037">37</a> of file <a class="el" href="componentfactory_8h-source.html">componentfactory.h</a>. </div> </div><p> <hr><h2>Function Documentation</h2> <a class="anchor" name="ea3f2ee59e87ce6476f0a9bd656807ea"></a><!-- doxytag: member="KParts::ComponentFactory::createInstanceFromFactory" ref="ea3f2ee59e87ce6476f0a9bd656807ea" args="(KLibFactory *factory, QObject *parent=0, const char *name=0, const QStringList &args=QStringList())" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T> </div> <table class="memname"> <tr> <td class="memname">static T* KParts::ComponentFactory::createInstanceFromFactory </td> <td>(</td> <td class="paramtype"><a class="elRef" doxygen="kdecore.tag:../../kdecore/html/" href="../../kdecore/html/classKLibFactory.html">KLibFactory</a> * </td> <td class="paramname"> <em>factory</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> * </td> <td class="paramname"> <em>parent</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>name</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> & </td> <td class="paramname"> <em>args</em> = <code><a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>()</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p> This template function allows to ask the given factory to create an instance of the given template type. <p> Example of usage: <div class="fragment"><pre class="fragment"> MyPlugin *plugin = KParts::ComponentFactory::createInstanceFromFactory<MyPlugin>( factory, parent ); </pre></div><p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>factory</em> </td><td>The factory to ask for the creation of the component </td></tr> <tr><td valign="top"></td><td valign="top"><em>parent</em> </td><td>The parent object (see <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> constructor) </td></tr> <tr><td valign="top"></td><td valign="top"><em>name</em> </td><td>The name of the object to create (see <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> constructor) </td></tr> <tr><td valign="top"></td><td valign="top"><em>args</em> </td><td>A list of string arguments, passed to the factory and possibly to the component (see <a class="elRef" doxygen="kdecore.tag:../../kdecore/html/" href="../../kdecore/html/classKLibFactory.html">KLibFactory</a>) </td></tr> </table> </dl> <dl compact><dt><b>Returns:</b></dt><dd>A pointer to the newly created object or a null pointer if the factory was unable to create an object of the given type. </dd></dl> <p> Definition at line <a class="el" href="componentfactory_8h-source.html#l00061">61</a> of file <a class="el" href="componentfactory_8h-source.html">componentfactory.h</a>. </div> </div><p> <a class="anchor" name="51396dbf12d4fec7a6d23649e089161e"></a><!-- doxytag: member="KParts::ComponentFactory::createPartInstanceFromFactory" ref="51396dbf12d4fec7a6d23649e089161e" args="(KParts::Factory *factory, QWidget *parentWidget=0, const char *widgetName=0, QObject *parent=0, const char *name=0, const QStringList &args=QStringList())" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T> </div> <table class="memname"> <tr> <td class="memname">static T* KParts::ComponentFactory::createPartInstanceFromFactory </td> <td>(</td> <td class="paramtype"><a class="el" href="classKParts_1_1Factory.html">KParts::Factory</a> * </td> <td class="paramname"> <em>factory</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="elRef" doxygen="qt.tag:" href="qwidget.html">QWidget</a> * </td> <td class="paramname"> <em>parentWidget</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>widgetName</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> * </td> <td class="paramname"> <em>parent</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>name</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> & </td> <td class="paramname"> <em>args</em> = <code><a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>()</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p> This template function allows to ask the given kparts factory to create an instance of the given template type. <p> Example of usage: <div class="fragment"><pre class="fragment"> KViewPart *doc = KParts::ComponentFactory::createPartInstanceFromFactory<KViewPart>( factory, parent ); </pre></div><p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>factory</em> </td><td>The factory to ask for the creation of the component </td></tr> <tr><td valign="top"></td><td valign="top"><em>parentWidget</em> </td><td>the parent widget for the part </td></tr> <tr><td valign="top"></td><td valign="top"><em>widgetName</em> </td><td>the name of the part's widget </td></tr> <tr><td valign="top"></td><td valign="top"><em>parent</em> </td><td>The parent object (see <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> constructor) </td></tr> <tr><td valign="top"></td><td valign="top"><em>name</em> </td><td>The name of the object to create (see <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> constructor) </td></tr> <tr><td valign="top"></td><td valign="top"><em>args</em> </td><td>A list of string arguments, passed to the factory and possibly to the component (see <a class="elRef" doxygen="kdecore.tag:../../kdecore/html/" href="../../kdecore/html/classKLibFactory.html">KLibFactory</a>) </td></tr> </table> </dl> <dl compact><dt><b>Returns:</b></dt><dd>A pointer to the newly created object or a null pointer if the factory was unable to create an object of the given type. </dd></dl> <p> Definition at line <a class="el" href="componentfactory_8h-source.html#l00095">95</a> of file <a class="el" href="componentfactory_8h-source.html">componentfactory.h</a>. </div> </div><p> <a class="anchor" name="9fe4287abe37f168857ef6e1fb7621f4"></a><!-- doxytag: member="KParts::ComponentFactory::createInstanceFromLibrary" ref="9fe4287abe37f168857ef6e1fb7621f4" args="(const char *libraryName, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T> </div> <table class="memname"> <tr> <td class="memname">static T* KParts::ComponentFactory::createInstanceFromLibrary </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>libraryName</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> * </td> <td class="paramname"> <em>parent</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>name</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> & </td> <td class="paramname"> <em>args</em> = <code><a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>()</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int * </td> <td class="paramname"> <em>error</em> = <code>0</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p> This template allows to load the specified library and ask the factory to create an instance of the given template type. <p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>libraryName</em> </td><td>The library to open </td></tr> <tr><td valign="top"></td><td valign="top"><em>parent</em> </td><td>The parent object (see <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> constructor) </td></tr> <tr><td valign="top"></td><td valign="top"><em>name</em> </td><td>The name of the object to create (see <a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> constructor) </td></tr> <tr><td valign="top"></td><td valign="top"><em>args</em> </td><td>A list of string arguments, passed to the factory and possibly to the component (see <a class="elRef" doxygen="kdecore.tag:../../kdecore/html/" href="../../kdecore/html/classKLibFactory.html">KLibFactory</a>) </td></tr> <tr><td valign="top"></td><td valign="top"><em>error</em> </td><td></td></tr> </table> </dl> <dl compact><dt><b>Returns:</b></dt><dd>A pointer to the newly created object or a null pointer if the factory was unable to create an object of the given type. </dd></dl> <p> Definition at line <a class="el" href="componentfactory_8h-source.html#l00127">127</a> of file <a class="el" href="componentfactory_8h-source.html">componentfactory.h</a>. </div> </div><p> <a class="anchor" name="66a8538016585af5338d9578b116a918"></a><!-- doxytag: member="KParts::ComponentFactory::createInstanceFromQuery" ref="66a8538016585af5338d9578b116a918" args="(const QString &serviceType, const QString &constraint=QString::null, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T> </div> <table class="memname"> <tr> <td class="memname">static T* KParts::ComponentFactory::createInstanceFromQuery </td> <td>(</td> <td class="paramtype">const <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> & </td> <td class="paramname"> <em>serviceType</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> & </td> <td class="paramname"> <em>constraint</em> = <code>QString::null</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> * </td> <td class="paramname"> <em>parent</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>name</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> & </td> <td class="paramname"> <em>args</em> = <code><a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>()</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int * </td> <td class="paramname"> <em>error</em> = <code>0</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p> This method creates and returns a plugin, from the trader query for a given serviceType. <p> Example: <div class="fragment"><pre class="fragment"> KMyAppPlugin* plugin = KParts::ComponentFactory::createInstanceFromQuery<KMyAppPlugin>( serviceType, QString::null, parentObject ); <span class="keywordflow">if</span> ( plugin ) { .... } </pre></div><p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>serviceType</em> </td><td>the type of service for which to find a plugin </td></tr> <tr><td valign="top"></td><td valign="top"><em>constraint</em> </td><td>an optional constraint to pass to the trader (see KIO::KTrader) </td></tr> <tr><td valign="top"></td><td valign="top"><em>parent</em> </td><td>the parent object for the part itself </td></tr> <tr><td valign="top"></td><td valign="top"><em>name</em> </td><td>the name that will be given to the part </td></tr> <tr><td valign="top"></td><td valign="top"><em>args</em> </td><td>A list of string arguments, passed to the factory and possibly to the component (see <a class="elRef" doxygen="kdecore.tag:../../kdecore/html/" href="../../kdecore/html/classKLibFactory.html">KLibFactory</a>) </td></tr> <tr><td valign="top"></td><td valign="top"><em>error</em> </td><td>The int passed here will receive an error code in case of errors. (See enum <a class="el" href="namespaceKParts_1_1ComponentFactory.html#a0f34004323782d3721aea693a7e9bfb">ComponentLoadingError</a>) </td></tr> </table> </dl> <dl compact><dt><b>Returns:</b></dt><dd>A pointer to the newly created object or a null pointer if the factory was unable to create an object of the given type. </dd></dl> <p> Definition at line <a class="el" href="componentfactory_8h-source.html#l00321">321</a> of file <a class="el" href="componentfactory_8h-source.html">componentfactory.h</a>. </div> </div><p> <a class="anchor" name="0af2316c53e9d4dedfedecd1badc5e72"></a><!-- doxytag: member="KParts::ComponentFactory::createPartInstanceFromQuery" ref="0af2316c53e9d4dedfedecd1badc5e72" args="(const QString &serviceType, const QString &constraint, QWidget *parentWidget=0, const char *widgetName=0, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T> </div> <table class="memname"> <tr> <td class="memname">static T* KParts::ComponentFactory::createPartInstanceFromQuery </td> <td>(</td> <td class="paramtype">const <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> & </td> <td class="paramname"> <em>serviceType</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> & </td> <td class="paramname"> <em>constraint</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="elRef" doxygen="qt.tag:" href="qwidget.html">QWidget</a> * </td> <td class="paramname"> <em>parentWidget</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>widgetName</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="elRef" doxygen="qt.tag:" href="qobject.html">QObject</a> * </td> <td class="paramname"> <em>parent</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>name</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a> & </td> <td class="paramname"> <em>args</em> = <code><a class="elRef" doxygen="qt.tag:" href="qstringlist.html">QStringList</a>()</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int * </td> <td class="paramname"> <em>error</em> = <code>0</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p> This method creates and returns a <a class="el" href="namespaceKParts.html">KParts</a> part from a serviceType (e.g. <p> a mimetype).<p> You can use this method to create a generic viewer - that can display any kind of file, provided that there is a <a class="el" href="classKParts_1_1ReadOnlyPart.html">ReadOnlyPart</a> installed for it - in 5 lines: <div class="fragment"><pre class="fragment"> <span class="comment">// Given the following: KURL url, QWidget* parentWidget and QObject* parentObject.</span> <a class="codeRef" doxygen="qt.tag:" href="qstring.html">QString</a> mimetype = KMimeType::findByURL( url )->name(); <a class="code" href="classKParts_1_1ReadOnlyPart.html">KParts::ReadOnlyPart</a>* part = KParts::ComponentFactory::createPartInstanceFromQuery<KParts::ReadOnlyPart>( mimetype, QString::null, parentWidget, 0, parentObject, 0 ); <span class="keywordflow">if</span> ( part ) { part-><a class="code" href="classKParts_1_1ReadOnlyPart.html#1717bbae9cbdfd38c6d9130914c29cd9">openURL</a>( url ); part-><a class="code" href="classKParts_1_1Part.html#2d2efd56fe23904104c48dc56371c03d">widget</a>()-><a class="codeRef" doxygen="qt.tag:" href="qwidget.html#show">show</a>(); <span class="comment">// also insert the widget into a layout, or simply use a QVBox as parentWidget</span> } </pre></div><p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>serviceType</em> </td><td>the type of service for which to find a part, e.g. a mimetype </td></tr> <tr><td valign="top"></td><td valign="top"><em>constraint</em> </td><td>an optional constraint to pass to the trader (see KTrader) </td></tr> <tr><td valign="top"></td><td valign="top"><em>parentWidget</em> </td><td>the parent widget, will be set as the parent of the part's widget </td></tr> <tr><td valign="top"></td><td valign="top"><em>widgetName</em> </td><td>the name that will be given to the part's widget </td></tr> <tr><td valign="top"></td><td valign="top"><em>parent</em> </td><td>the parent object for the part itself </td></tr> <tr><td valign="top"></td><td valign="top"><em>name</em> </td><td>the name that will be given to the part </td></tr> <tr><td valign="top"></td><td valign="top"><em>args</em> </td><td>A list of string arguments, passed to the factory and possibly to the component (see <a class="elRef" doxygen="kdecore.tag:../../kdecore/html/" href="../../kdecore/html/classKLibFactory.html">KLibFactory</a>) </td></tr> <tr><td valign="top"></td><td valign="top"><em>error</em> </td><td>The int passed here will receive an error code in case of errors. (See enum <a class="el" href="namespaceKParts_1_1ComponentFactory.html#a0f34004323782d3721aea693a7e9bfb">ComponentLoadingError</a>) </td></tr> </table> </dl> <dl compact><dt><b>Returns:</b></dt><dd>A pointer to the newly created object or a null pointer if the factory was unable to create an object of the given type. </dd></dl> <p> Definition at line <a class="el" href="componentfactory_8h-source.html#l00370">370</a> of file <a class="el" href="componentfactory_8h-source.html">componentfactory.h</a>. </div> </div><p> </div></div> </td> </tr> <tr> <td valign="top" id="leftmenu" width="25%"> <a name="navigation"></a> <div class="menu_box"><h2>kparts</h2> <div class="nav_list"> <ul><li><a href="index.html">Main Page</a></li><li><a href="namespaces.html">Namespace List</a></li><li><a href="hierarchy.html">Class Hierarchy</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="files.html">File List</a></li><li><a href="namespacemembers.html">Namespace Members</a></li><li><a href="functions.html">Class Members</a></li></ul> <!-- <h2>Class Picker</h2> <div style="text-align: center;"> <form name="guideform"> <select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value"> <option value="annotated.html">-- Choose --</option> <option value="classKParts_1_1BrowserExtension.html">kparts::browserextension</option>, <option value="classKParts_1_1BrowserHostExtension.html">kparts::browserhostextension</option>, <option value="classKParts_1_1BrowserInterface.html">kparts::browserinterface</option>, <option value="classKParts_1_1BrowserRun.html">kparts::browserrun</option>, <option value="classKParts_1_1DockMainWindow.html">kparts::dockmainwindow</option>, <option value="classKParts_1_1Event.html">kparts::event</option>, <option value="classKParts_1_1Factory.html">kparts::factory</option>, <option value="classKParts_1_1GenericFactory.html">kparts::genericfactory</option>, <option value="classKParts_1_1GenericFactory_3_01KTypeList_3_01T1_00_01T2_01_4_01_4.html">kparts::genericfactory< ktypelist< t1, t2 > ></option>, <option value="classKParts_1_1GenericFactoryBase.html">kparts::genericfactorybase</option>, <option value="classKParts_1_1GUIActivateEvent.html">kparts::guiactivateevent</option>, <option value="classKParts_1_1HistoryProvider.html">kparts::historyprovider</option>, <option value="classKParts_1_1LiveConnectExtension.html">kparts::liveconnectextension</option>, <option value="classKParts_1_1MainWindow.html">kparts::mainwindow</option>, <option value="classKParts_1_1OpenURLEvent.html">kparts::openurlevent</option>, <option value="classKParts_1_1Part.html">kparts::part</option>, <option value="classKParts_1_1PartActivateEvent.html">kparts::partactivateevent</option>, <option value="classKParts_1_1PartBase.html">kparts::partbase</option>, <option value="classKParts_1_1PartManager.html">kparts::partmanager</option>, <option value="classKParts_1_1PartSelectEvent.html">kparts::partselectevent</option>, <option value="classKParts_1_1Plugin.html">kparts::plugin</option>, <option value="classKParts_1_1ReadOnlyPart.html">kparts::readonlypart</option>, <option value="classKParts_1_1ReadWritePart.html">kparts::readwritepart</option>, <option value="classKParts_1_1StatusBarExtension.html">kparts::statusbarextension</option>, </select> </form> </div> --> </div></div> <div class="menu_box"><h2>API Dox</h2> <div class="nav_list"> <ul> <li><a href="../../arts/html/index.html">arts</a></li><li><a href="../../dcop/html/index.html">dcop</a></li><li><a href="../../dnssd/html/index.html">dnssd</a></li><li><a href="../../interfaces/html/index.html">interfaces</a></li><li> <a href="../../interfaces/kimproxy/interface/html/index.html">interface</a></li><li> <a href="../../interfaces/kimproxy/library/html/index.html">library</a></li><li> <a href="../../interfaces/kspeech/html/index.html">kspeech</a></li><li> <a href="../../interfaces/ktexteditor/html/index.html">ktexteditor</a></li><li><a href="../../kabc/html/index.html">kabc</a></li><li><a href="../../kate/html/index.html">kate</a></li><li><a href="../../kcmshell/html/index.html">kcmshell</a></li><li><a href="../../kdecore/html/index.html">kdecore</a></li><li><a href="../../kded/html/index.html">kded</a></li><li><a href="../../kdefx/html/index.html">kdefx</a></li><li><a href="../../kdeprint/html/index.html">kdeprint</a></li><li><a href="../../kdesu/html/index.html">kdesu</a></li><li><a href="../../kdeui/html/index.html">kdeui</a></li><li><a href="../../kdoctools/html/index.html">kdoctools</a></li><li><a href="../../khtml/html/index.html">khtml</a></li><li><a href="../../kimgio/html/index.html">kimgio</a></li><li><a href="../../kinit/html/index.html">kinit</a></li><li><a href="../../kio/html/index.html">kio</a></li><li> <a href="../../kio/bookmarks/html/index.html">bookmarks</a></li><li> <a href="../../kio/httpfilter/html/index.html">httpfilter</a></li><li> <a href="../../kio/kfile/html/index.html">kfile</a></li><li> <a href="../../kio/kio/html/index.html">kio</a></li><li> <a href="../../kio/kioexec/html/index.html">kioexec</a></li><li> <a href="../../kio/kpasswdserver/html/index.html">kpasswdserver</a></li><li> <a href="../../kio/kssl/html/index.html">kssl</a></li><li><a href="../../kioslave/html/index.html">kioslave</a></li><li> <a href="../../kioslave/http/html/index.html">http</a></li><li><a href="../../kjs/html/index.html">kjs</a></li><li><a href="../../kmdi/html/index.html">kmdi</a></li><li> <a href="../../kmdi/kmdi/html/index.html">kmdi</a></li><li><a href="../../knewstuff/html/index.html">knewstuff</a></li><li><a href="../../kparts/html/index.html">kparts</a></li><li><a href="../../kresources/html/index.html">kresources</a></li><li><a href="../../kspell2/html/index.html">kspell2</a></li><li><a href="../../kunittest/html/index.html">kunittest</a></li><li><a href="../../kutils/html/index.html">kutils</a></li><li><a href="../../kwallet/html/index.html">kwallet</a></li><li><a href="../../libkmid/html/index.html">libkmid</a></li><li><a href="../../libkscreensaver/html/index.html">libkscreensaver</a></li> </ul></div></div> </td> </tr> </table> <span class="doNotDisplay"> <a href="http://www.kde.org/" accesskey="8">KDE Home</a> | <a href="http://accessibility.kde.org/" accesskey="9">KDE Accessibility Home</a> | <a href="http://www.kde.org/media/accesskeys.php" accesskey="0">Description of Access Keys</a> </span> <div style="height: 8px"></div> <div id="footer"> <div id="footer_left"> Maintained by <a href="mailto:groot@kde.org">Adriaan de Groot</a> and <a href="mailto:wintert@kde.org">Allen Winter</a>. <br/> KDE and K Desktop Environment are trademarks of <a href="http://www.kde.org/areas/kde-ev/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> | <a href="http://www.kde.org/contact/impressum.php">Legal</a> </div> <div id="footer_right"><img src="/media/images/footer_right.png" style="margin: 0px" alt="" /></div> </div> <!-- WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL BE BLOCKED INSTANTLY AND PERMANENTLY! <a href="mailto:aaaatrap-425acc3b5374943f@kde.org">Block me</a> WARNING END --> </body> </html>