Home · All Classes · Main Classes · Annotated · Grouped Classes · Functions

QResource Class Reference

The QResource class provides access to application resource data. More...

#include <QResource>

Part of the QtCore module.

Note: All the functions in this class are reentrant.

Public Functions

Static Public Members


Detailed Description

The QResource class provides access to application resource data.

QResources are created and used internally although they can also be used for direct access to the application's current resources. Resources must be accessed using absolute paths. Compression and encryption are taken care of internally.

Use find() to find a resource. A resource has a name(), a size(), and either data() or children() (child resources). A resource may also have another resource as its parent().

Another way of iterating through an application's resource is to use a QDir initialized with ":/" (the resource root). QDir and QFileInfo work just as well on resources as on actual files located in the file system.

See also The Qt Resource System.


Member Function Documentation

void QResource::addSearchPath ( const QString & path )   [static]

Adds path to the search paths searched in to find resources that are not specified with an absolute path. The default search path is to search only in the root ('/').

See also QResource::find().

QList<QResource *> QResource::children () const

Returns a list of the resource's child nodes. If there are no children or isContainer() returns false, an empty list is returned.

See also isContainer().

const uchar * QResource::data () const

Returns the resource's data (uncompressed).

See also isContainer() and children().

QResource * QResource::find ( const QString & resource )   [static]

Returns the resource located at path resource, or 0 if no resource is found. Relative resources will be searched for through the search path. Resources are separated from their containing resource with forward slashes ('/') regardless of local file system.

See also QResource::addSearchPath().

bool QResource::isContainer () const

Returns true if this resource contains at least one other resource (and thus has no data); otherwise returns false.

See also children() and parent().

QString QResource::name () const

Returns the resource's node name, which is "/" if this resource is at the root of the resource system.

const QResource * QResource::parent () const

Returns the resource that contains this resource, or 0 if this resource is at the root of the resource system.

uint QResource::size () const

Returns the uncompressed size of the resource.


Copyright © 2005 Trolltech Trademarks
Qt 4.0.0-b2