Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QPixmapCache

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.gui.QPixmapCache

All Implemented Interfaces:
  QtJambiInterface

    public class QPixmapCache

extends QtJambiObject

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.

See also:
  QCache, and `QPixmap`.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

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()`

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

### QPixmapCache

    public QPixmapCache()

Method Detail

### cacheLimit

    public static int cacheLimit()

  Returns the cache limit (in kilobytes).

  The default setting is 1024 kilobytes.

See also:
  `setCacheLimit()`.

### clear

    public static void clear()

  Removes all pixmaps from the cache.

### insert

    public static boolean insert(java.lang.String key,
                                 QPixmap arg__2)

  Inserts a copy of the pixmap `pm` associated with the `key` into the cache.

  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.

See also:
  `setCacheLimit()`.

### remove

    public static void remove(java.lang.String key)

  Removes the pixmap associated with `key` from the cache.

### setCacheLimit

    public static void setCacheLimit(int arg__1)

  Sets the cache limit to `n` kilobytes.

  The default setting is 1024 kilobytes.

See also:
  `cacheLimit()`.

### find

    public static boolean find(java.lang.String key,
                               QPixmap pm)

  Looks for a cached pixmap associated with the `key` in the cache. If the pixmap is found, the function sets `pm` to that pixmap and returns true; otherwise it leaves `pm` alone and returns false.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD