Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 930

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QPluginLoader Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QPluginLoader Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QPluginLoader class loads a plugin at run-time. <a href="#details">More...</a></p>

<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qpluginloader.html#QPluginLoader">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qpluginloader.html#QPluginLoader-2">__init__</a></b> (<i>self</i>, QString&#160;<i>fileName</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />QString <b><a href="qpluginloader.html#errorString">errorString</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qpluginloader.html#fileName">fileName</a></b> (<i>self</i>)</li><li><div class="fn" />QObject <b><a href="qpluginloader.html#instance">instance</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpluginloader.html#isLoaded">isLoaded</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpluginloader.html#load">load</a></b> (<i>self</i>)</li><li><div class="fn" />QLibrary.LoadHints <b><a href="qpluginloader.html#loadHints">loadHints</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpluginloader.html#setFileName">setFileName</a></b> (<i>self</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" /><b><a href="qpluginloader.html#setLoadHints">setLoadHints</a></b> (<i>self</i>, QLibrary.LoadHints&#160;<i>loadHints</i>)</li><li><div class="fn" />bool <b><a href="qpluginloader.html#unload">unload</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />list-of-QObject <b><a href="qpluginloader.html#staticInstances">staticInstances</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPluginLoader class loads a plugin at run-time.</p>
<p>QPluginLoader provides access to a <a href="plugins-howto.html">Qt plugin</a>. A Qt plugin is stored in a
shared library (a DLL) and offers these benefits over shared
libraries accessed using <a href="qlibrary.html">QLibrary</a>:</p>
<ul>
<li>QPluginLoader checks that a plugin is linked against the same
version of Qt as the application.</li>
<li>QPluginLoader provides direct access to a root component object
(<a href="qpluginloader.html#instance">instance</a>()), instead of
forcing you to resolve a C function manually.</li>
</ul>
<p>An instance of a QPluginLoader object operates on a single
shared library file, which we call a plugin. It provides access to
the functionality in the plugin in a platform-independent way. To
specify which plugin to load, either pass a file name in the
constructor or set it with <a href="qpluginloader.html#fileName-prop">setFileName</a>().</p>
<p>The most important functions are <a href="qpluginloader.html#load">load</a>() to dynamically load the plugin
file, <a href="qpluginloader.html#isLoaded">isLoaded</a>() to check
whether loading was successful, and <a href="qpluginloader.html#instance">instance</a>() to access the root
component in the plugin. The <a href="qpluginloader.html#instance">instance</a>() function implicitly
tries to load the plugin if it has not been loaded yet. Multiple
instances of QPluginLoader can be used to access the same physical
plugin.</p>
<p>Once loaded, plugins remain in memory until all instances of
QPluginLoader has been unloaded, or until the application
terminates. You can attempt to unload a plugin using <a href="qpluginloader.html#unload">unload</a>(), but if other instances of
QPluginLoader are using the same library, the call will fail, and
unloading will only happen when every instance has called <a href="qpluginloader.html#unload">unload</a>(). Right before the
unloading happen, the root component will also be deleted.</p>
<p>In order to speed up loading and validation of plugins, some of
the information that is collected during loading is cached in
persistent memory (through <a href="qsettings.html">QSettings</a>).
For instance, the result of a load operation (e.g. succeeded or
failed) is stored in the cache, so that subsequent load operations
don't try to load an invalid plugin. However, if the "last
modified" timestamp of a plugin has changed, the plugin's cache
entry is invalidated and the plugin is reloaded regardless of the
values in the cache entry. The cache entry is then updated with the
new result of the load operation.</p>
<p>This also means that the timestamp must be updated each time the
plugin or any dependent resources (such as a shared library) is
updated, since the dependent resources might influence the result
of loading a plugin.</p>
<p>See <a href="plugins-howto.html">How to Create Qt Plugins</a>
for more information about how to make your application extensible
through plugins.</p>
<p>Note that the QPluginLoader cannot be used if your application
is statically linked against Qt. In this case, you will also have
to link to plugins statically. You can use <a href="qlibrary.html">QLibrary</a> if you need to load dynamic libraries
in a statically linked application.</p>
<p><b>Note:</b> In Symbian the plugin stub files must be used
whenever a path to plugin is needed. For the purposes of loading
plugins, the stubs can be considered to have the same name as the
actual plugin binary. In practice they have ".qtplugin" extension
instead of ".dll", but this difference is handled transparently by
QPluginLoader and <a href="qlibrary.html">QLibrary</a> to avoid
need for Symbian specific plugin handling in most Qt applications.
Plugin stubs are needed because Symbian Platform Security denies
all access to the directory where the actual plugin binaries are
located.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPluginLoader" />QPluginLoader.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a plugin loader with the given <i>parent</i>.</p>


<h3 class="fn"><a name="QPluginLoader-2" />QPluginLoader.__init__ (<i>self</i>, QString&#160;<i>fileName</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a plugin loader with the given <i>parent</i> that
will load the plugin specified by <i>fileName</i>.</p>
<p>To be loadable, the file's suffix must be a valid suffix for a
loadable library in accordance with the platform, e.g. <tt>.so</tt>
on Unix, - <tt>.dylib</tt> on Mac OS X, and <tt>.dll</tt> on
Windows. The suffix can be verified with <a href="qlibrary.html#isLibrary">QLibrary.isLibrary</a>().</p>
<p>Note: In Symbian the <i>fileName</i> must point to plugin stub
file.</p>
<p><b>See also</b> <a href="qpluginloader.html#fileName-prop">setFileName</a>().</p>


<h3 class="fn"><a name="errorString" />QString QPluginLoader.errorString (<i>self</i>)</h3><p>Returns a text string with the description of the last error
that occurred.</p>
<p>This function was introduced in Qt 4.2.</p>


<h3 class="fn"><a name="fileName" />QString QPluginLoader.fileName (<i>self</i>)</h3><h3 class="fn"><a name="instance" /><a href="qobject.html">QObject</a> QPluginLoader.instance (<i>self</i>)</h3><p>Returns the root component object of the plugin. The plugin is
loaded if necessary. The function returns 0 if the plugin could not
be loaded or if the root component object could not be
instantiated.</p>
<p>If the root component object was destroyed, calling this
function creates a new instance.</p>
<p>The root component, returned by this function, is not deleted
when the <a href="qpluginloader.html">QPluginLoader</a> is
destroyed. If you want to ensure that the root component is
deleted, you should call <a href="qpluginloader.html#unload">unload</a>() as soon you don't need to
access the core component anymore. When the library is finally
unloaded, the root component will automatically be deleted.</p>
<p>The component object is a <a href="qobject.html">QObject</a>.
Use <a href="qobject.html#qobject_cast">qobject_cast</a>() to
access interfaces you are interested in.</p>
<p><b>See also</b> <a href="qpluginloader.html#load">load</a>().</p>


<h3 class="fn"><a name="isLoaded" />bool QPluginLoader.isLoaded (<i>self</i>)</h3><p>Returns true if the plugin is loaded; otherwise returns
false.</p>
<p><b>See also</b> <a href="qpluginloader.html#load">load</a>().</p>


<h3 class="fn"><a name="load" />bool QPluginLoader.load (<i>self</i>)</h3><p>Loads the plugin and returns true if the plugin was loaded
successfully; otherwise returns false. Since <a href="qpluginloader.html#instance">instance</a>() always calls this
function before resolving any symbols it is not necessary to call
it explicitly. In some situations you might want the plugin loaded
in advance, in which case you would use this function.</p>
<p><b>See also</b> <a href="qpluginloader.html#unload">unload</a>().</p>


<h3 class="fn"><a name="loadHints" /><a href="qlibrary-loadhints.html">QLibrary.LoadHints</a> QPluginLoader.loadHints (<i>self</i>)</h3><h3 class="fn"><a name="setFileName" />QPluginLoader.setFileName (<i>self</i>, QString&#160;<i>fileName</i>)</h3><h3 class="fn"><a name="setLoadHints" />QPluginLoader.setLoadHints (<i>self</i>, <a href="qlibrary-loadhints.html">QLibrary.LoadHints</a>&#160;<i>loadHints</i>)</h3><h3 class="fn"><a name="staticInstances" />list-of-QObject QPluginLoader.staticInstances ()</h3><p>Returns a list of static plugin instances (root components) held
by the plugin loader.</p>


<h3 class="fn"><a name="unload" />bool QPluginLoader.unload (<i>self</i>)</h3><p>Unloads the plugin and returns true if the plugin could be
unloaded; otherwise returns false.</p>
<p>This happens automatically on application termination, so you
shouldn't normally need to call this function.</p>
<p>If other instances of <a href="qpluginloader.html">QPluginLoader</a> are using the same plugin,
the call will fail, and unloading will only happen when every
instance has called unload().</p>
<p>Don't try to delete the root component. Instead rely on that
unload() will automatically delete it when needed.</p>
<p><b>See also</b> <a href="qpluginloader.html#instance">instance</a>() and <a href="qpluginloader.html#load">load</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>