Sophie

Sophie

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

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>QResource 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">QResource Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QResource class provides an interface for reading directly
from resources. <a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qresource.html#QResource">__init__</a></b> (<i>self</i>, QString&#160;<i>fileName</i>&#160;=&#160;QString(), QLocale&#160;<i>locale</i>&#160;=&#160;QLocale())</li><li><div class="fn" />QString <b><a href="qresource.html#absoluteFilePath">absoluteFilePath</a></b> (<i>self</i>)</li><li><div class="fn" />QStringList <b><a href="qresource.html#children">children</a></b> (<i>self</i>)</li><li><div class="fn" />str <b><a href="qresource.html#data">data</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qresource.html#fileName">fileName</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qresource.html#isCompressed">isCompressed</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qresource.html#isDir">isDir</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qresource.html#isFile">isFile</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qresource.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />QLocale <b><a href="qresource.html#locale">locale</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qresource.html#setFileName">setFileName</a></b> (<i>self</i>, QString&#160;<i>file</i>)</li><li><div class="fn" /><b><a href="qresource.html#setLocale">setLocale</a></b> (<i>self</i>, QLocale&#160;<i>locale</i>)</li><li><div class="fn" />int <b><a href="qresource.html#size">size</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" /><b><a href="qresource.html#addSearchPath">addSearchPath</a></b> (QString&#160;<i>path</i>)</li><li><div class="fn" />bool <b><a href="qresource.html#registerResource">registerResource</a></b> (QString&#160;<i>rccFileName</i>, QString&#160;<i>mapRoot</i>&#160;=&#160;QString())</li><li><div class="fn" />bool <b><a href="qresource.html#registerResourceData">registerResourceData</a></b> (str&#160;<i>rccData</i>, QString&#160;<i>mapRoot</i>&#160;=&#160;QString())</li><li><div class="fn" />QStringList <b><a href="qresource.html#searchPaths">searchPaths</a></b> ()</li><li><div class="fn" />bool <b><a href="qresource.html#unregisterResource">unregisterResource</a></b> (QString&#160;<i>rccFileName</i>, QString&#160;<i>mapRoot</i>&#160;=&#160;QString())</li><li><div class="fn" />bool <b><a href="qresource.html#unregisterResourceData">unregisterResourceData</a></b> (str&#160;<i>rccData</i>, QString&#160;<i>mapRoot</i>&#160;=&#160;QString())</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QResource class provides an interface for reading directly
from resources.</p>
<p>QResource is an object that represents a set of data (and
possibly children) relating to a single resource entity. QResource
gives direct access to the bytes in their raw format. In this way
direct access allows reading data without buffer copying or
indirection. Indirection is often useful when interacting with the
resource entity as if it is a file, this can be achieved with
<a href="qfile.html">QFile</a>. The data and children behind a
QResource are normally compiled into an application/library, but it
is also possible to load a resource at runtime. When loaded at run
time the resource file will be loaded as one big set of data and
then given out in pieces via references into the resource tree.</p>
<p>A QResource can either be loaded with an absolute path, either
treated as a file system rooted with a <tt>/</tt> character, or in
resource notation rooted with a <tt>:</tt> character. A relative
resource can also be opened which will be found in the list of
paths returned by <a href="qdir.html#searchPaths">QDir.searchPaths</a>().</p>
<p>A QResource that is representing a file will have data backing
it, this data can possibly be compressed, in which case <a href="qtcore.html#qUncompress">qUncompress</a>() must be used to
access the real data; this happens implicitly when accessed through
a <a href="qfile.html">QFile</a>. A QResource that is representing
a directory will have only children and no data.</p>
<a id="dynamic-resource-loading" name="dynamic-resource-loading" />
<h3>Dynamic Resource Loading</h3>
<p>A resource can be left out of an application's binary and loaded
when it is needed at run-time by using the <a href="qresource.html#registerResource">registerResource</a>() function.
The resource file passed into <a href="qresource.html#registerResource">registerResource</a>() must be a
binary resource as created by rcc. Further information about binary
resources can be found in <a href="resources.html">The Qt Resource
System</a> documentation.</p>
<p>This can often be useful when loading a large set of application
icons that may change based on a setting, or that can be edited by
a user and later recreated. The resource is immediately loaded into
memory, either as a result of a single file read operation, or as a
memory mapped file.</p>
<p>This approach can prove to be a significant performance gain as
only a single file will be loaded, and pieces of data will be given
out via the path requested in <a href="qresource.html#setFileName">setFileName</a>().</p>
<p>The <a href="qresource.html#unregisterResource">unregisterResource</a>()
function removes a reference to a particular file. If there are
QResources that currently reference resources related to the
unregistered file, they will continue to be valid but the resource
file itself will be removed from the resource roots, and thus no
further QResource can be created pointing into this resource data.
The resource itself will be unmapped from memory when the last
QResource that points to it is destroyed.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QResource" />QResource.__init__ (<i>self</i>, QString&#160;<i>fileName</i>&#160;=&#160;QString(), <a href="qlocale.html">QLocale</a>&#160;<i>locale</i>&#160;=&#160;QLocale())</h3><p>Constructs a <a href="qresource.html">QResource</a> pointing to
<i>file</i>. <i>locale</i> is used to load a specific localization
of a resource data.</p>
<p><b>See also</b> <a href="qfileinfo.html">QFileInfo</a>, <a href="qdir.html#searchPaths">QDir.searchPaths</a>(), <a href="qresource.html#setFileName">setFileName</a>(), and <a href="qresource.html#setLocale">setLocale</a>().</p>


<h3 class="fn"><a name="absoluteFilePath" />QString QResource.absoluteFilePath (<i>self</i>)</h3><p>Returns the real path that this <a href="qresource.html">QResource</a> represents, if the resource was
found via the <a href="qdir.html#searchPaths">QDir.searchPaths</a>() it will be
indicated in the path.</p>
<p><b>See also</b> <a href="qresource.html#fileName">fileName</a>().</p>


<h3 class="fn"><a name="addSearchPath" />QResource.addSearchPath (QString&#160;<i>path</i>)</h3><h3 class="fn"><a name="children" />QStringList QResource.children (<i>self</i>)</h3><p>Returns a list of all resources in this directory, if the
resource represents a file the list will be empty.</p>
<p><b>See also</b> <a href="qresource.html#isDir">isDir</a>().</p>


<h3 class="fn"><a name="data" />str QResource.data (<i>self</i>)</h3><p>Returns direct access to a read only segment of data that this
resource represents. If the resource is compressed the data returns
is compressed and <a href="qtcore.html#qUncompress">qUncompress</a>() must be used to
access the data. If the resource is a directory 0 is returned.</p>
<p><b>See also</b> <a href="qresource.html#size">size</a>(),
<a href="qresource.html#isCompressed">isCompressed</a>(), and
<a href="qresource.html#isFile">isFile</a>().</p>


<h3 class="fn"><a name="fileName" />QString QResource.fileName (<i>self</i>)</h3><p>Returns the full path to the file that this <a href="qresource.html">QResource</a> represents as it was passed.</p>
<p><b>See also</b> <a href="qresource.html#setFileName">setFileName</a>() and <a href="qresource.html#absoluteFilePath">absoluteFilePath</a>().</p>


<h3 class="fn"><a name="isCompressed" />bool QResource.isCompressed (<i>self</i>)</h3><p>Returns true if the resource represents a file and the data
backing it is in a compressed format, false otherwise.</p>
<p><b>See also</b> <a href="qresource.html#data">data</a>() and
<a href="qresource.html#isFile">isFile</a>().</p>


<h3 class="fn"><a name="isDir" />bool QResource.isDir (<i>self</i>)</h3><p>Returns true if the resource represents a directory and thus may
have <a href="qresource.html#children">children</a>() in it, false
if it represents a file.</p>
<p><b>See also</b> <a href="qresource.html#isFile">isFile</a>().</p>


<h3 class="fn"><a name="isFile" />bool QResource.isFile (<i>self</i>)</h3><p>Returns true if the resource represents a file and thus has data
backing it, false if it represents a directory.</p>
<p><b>See also</b> <a href="qresource.html#isDir">isDir</a>().</p>


<h3 class="fn"><a name="isValid" />bool QResource.isValid (<i>self</i>)</h3><p>Returns true if the resource really exists in the resource
hierarchy, false otherwise.</p>


<h3 class="fn"><a name="locale" /><a href="qlocale.html">QLocale</a> QResource.locale (<i>self</i>)</h3><p>Returns the locale used to locate the data for the <a href="qresource.html">QResource</a>.</p>
<p><b>See also</b> <a href="qresource.html#setLocale">setLocale</a>().</p>


<h3 class="fn"><a name="registerResource" />bool QResource.registerResource (QString&#160;<i>rccFileName</i>, QString&#160;<i>mapRoot</i>&#160;=&#160;QString())</h3><p>Registers the resource with the given <i>rccFileName</i> at the
location in the resource tree specified by <i>mapRoot</i>, and
returns true if the file is successfully opened; otherwise returns
false.</p>
<p><b>See also</b> <a href="qresource.html#unregisterResource">unregisterResource</a>().</p>


<h3 class="fn"><a name="registerResourceData" />bool QResource.registerResourceData (str&#160;<i>rccData</i>, QString&#160;<i>mapRoot</i>&#160;=&#160;QString())</h3><h3 class="fn"><a name="searchPaths" />QStringList QResource.searchPaths ()</h3><h3 class="fn"><a name="setFileName" />QResource.setFileName (<i>self</i>, QString&#160;<i>file</i>)</h3><p>Sets a <a href="qresource.html">QResource</a> to point to
<i>file</i>. <i>file</i> can either be absolute, in which case it
is opened directly, if relative then the file will be tried to be
found in <a href="qdir.html#searchPaths">QDir.searchPaths</a>().</p>
<p><b>See also</b> <a href="qresource.html#fileName">fileName</a>()
and <a href="qresource.html#absoluteFilePath">absoluteFilePath</a>().</p>


<h3 class="fn"><a name="setLocale" />QResource.setLocale (<i>self</i>, <a href="qlocale.html">QLocale</a>&#160;<i>locale</i>)</h3><p>Sets a <a href="qresource.html">QResource</a> to only load the
localization of resource to for <i>locale</i>. If a resource for
the specific locale is not found then the C locale is used.</p>
<p><b>See also</b> <a href="qresource.html#locale">locale</a>() and
<a href="qresource.html#setFileName">setFileName</a>().</p>


<h3 class="fn"><a name="size" />int QResource.size (<i>self</i>)</h3><p>Returns the size of the data backing the resource.</p>
<p><b>See also</b> <a href="qresource.html#data">data</a>() and
<a href="qresource.html#isFile">isFile</a>().</p>


<h3 class="fn"><a name="unregisterResource" />bool QResource.unregisterResource (QString&#160;<i>rccFileName</i>, QString&#160;<i>mapRoot</i>&#160;=&#160;QString())</h3><p>Unregisters the resource with the given <i>rccFileName</i> at
the location in the resource tree specified by <i>mapRoot</i>, and
returns true if the resource is successfully unloaded and no
references exist for the resource; otherwise returns false.</p>
<p><b>See also</b> <a href="qresource.html#registerResource">registerResource</a>().</p>


<h3 class="fn"><a name="unregisterResourceData" />bool QResource.unregisterResourceData (str&#160;<i>rccData</i>, QString&#160;<i>mapRoot</i>&#160;=&#160;QString())</h3><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>