|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.gui.QPixmapCache
public class QPixmapCache
The QPixmapCache class provides an application-wide cache for pixmaps. This class is a tool for optimized drawing with QPixmap
. You can use it to store temporary pixmaps that are expensive to generate without using more storage space than cacheLimit()
. Use insert()
to insert pixmaps, find()
to find them, and clear()
to empty the cache.
QPixmapCache contains no member data, only static functions to access the global pixmap cache. It creates an internal QCache object for caching the pixmaps.
The cache associates a pixmap with a string (key). If two pixmaps are inserted into the cache using equal keys, then the last pixmap will hide the first pixmap. The QHash and QCache classes do exactly the same.
The cache becomes full when the total size of all pixmaps in the cache exceeds cacheLimit()
. The initial cache limit is 1024 KB (1 MB); it is changed with setCacheLimit()
. A pixmap takes roughly (width * height * depth)/8 bytes of memory.
The Qt Quarterly article Optimizing with QPixmapCache explains how to use QPixmapCache to speed up applications by caching the results of painting.
QPixmap
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary |
---|
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
QPixmapCache()
This is an overloaded method provided for convenience. |
Method Summary | |
---|---|
static int |
cacheLimit()
Returns the cache limit (in kilobytes). |
static void |
clear()
Removes all pixmaps from the cache. |
static boolean |
find(java.lang.String key,
QPixmap pm)
Looks for a cached pixmap associated with the key in the cache. |
static boolean |
insert(java.lang.String key,
QPixmap arg__2)
Inserts a copy of the pixmap pm associated with the key into the cache. |
static void |
remove(java.lang.String key)
Removes the pixmap associated with key from the cache. |
static void |
setCacheLimit(int arg__1)
Sets the cache limit to n kilobytes. |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QPixmapCache()
Method Detail |
---|
public static int cacheLimit()
The default cache limit is 2048 KB for Embedded, 10240 KB for Desktops.
setCacheLimit()
.
public static void clear()
public static boolean insert(java.lang.String key, QPixmap arg__2)
All pixmaps inserted by the Qt library have a key starting with "$qt", so your own pixmap keys should never begin "$qt".
When a pixmap is inserted and the cache is about to exceed its limit, it removes pixmaps until there is enough room for the pixmap to be inserted.
The oldest pixmaps (least recently accessed in the cache) are deleted when more space is needed.
The function returns true if the object was inserted into the cache; otherwise it returns false.
setCacheLimit()
.
public static void remove(java.lang.String key)
public static void setCacheLimit(int arg__1)
The default setting is 1024 kilobytes.
cacheLimit()
.
public static boolean find(java.lang.String key, QPixmap pm)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |