Overview | Package | Class | Tree | Deprecated | Index | Help
Qt Jambi Home |
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.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`, `QPixmap`

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>`

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 QPixmapCache` | `fromNativePointer(QNativePointer nativePointer)` This function returns the QPixmapCache instance pointed to by nativePointer
`static boolean` | `insert(java.lang.String key, QPixmap arg__2)` Inserts a copy of the pixmap `arg__2` 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 `arg__1` kilobytes.

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

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 `arg__2` 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 `arg__1` kilobytes.

  The default setting is 1024 kilobytes.

  See Also:
    `cacheLimit`

### fromNativePointer

    public static QPixmapCache fromNativePointer(QNativePointer nativePointer)

  This function returns the QPixmapCache instance pointed to by nativePointer

  Parameters:
    `nativePointer` - the QNativePointer of which object should be returned.

### 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
Qt Jambi Home |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD