PythonQt.Qt.QPixmapCache
QPixmapCache
PythonQtInstanceWrapper object
Native bases: PythonQtInstanceWrapper
Supplemental documentation: Qt 5 reference:
Detailed Description
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 user-provided string as a key, or with a QPixmapCache::Key that the cache generates. Using QPixmapCache::Key for keys is faster than using strings. The string API is very convenient for complex keys but the QPixmapCache::Key API will be very efficient and convenient for a one-to-one object-to-pixmap mapping - in this case, you can store the keys as members of an object.
If two pixmaps are inserted into the cache using equal keys then the last pixmap will replace the first pixmap in the cache. This follows the behavior of the QHash and QCache classes.
The cache becomes full when the total size of all pixmaps in the cache exceeds cacheLimit(). The initial cache limit is 10240 KB (10 MB); you can change this by calling setCacheLimit() with the required value. 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.
Note: QPixmapCache is only usable from the application's main thread. Access from other threads will be ignored and return failure.
Source: https://doc.qt.io/archives/qt-5.15/qpixmapcache.html
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
Key |
attribute | type |
(shared captured text) |
__init__ |
function | (self, *args: Any, **kwargs: Any) -> None |
Native constructor; consult class documentation for supported overloads. (shared captured text) |
cacheLimit |
function | (self) -> int |
X.cacheLimit() -> int (shared captured text) |
className |
function | (self, *args: Any, **kwargs: Any) -> Any |
Return the classname of the object (shared captured text) |
clear |
function | (self) -> None |
Removes all pixmaps from the cache. (shared captured text) |
delete |
function | (self, *args: Any, **kwargs: Any) -> Any |
Deletes the C++ object (at your own risk, my friend!) (shared captured text) |
find |
function | (self, key: Any, pixmap: Any) -> bool |
X.find(key, pixmap) -> bool (shared captured text) |
help |
function | (self, *args: Any, **kwargs: Any) -> Any |
Shows the help of available methods for this class (shared captured text) |
inherits |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns if the class inherits or is of given type name (shared captured text) |
insert |
function | (self, key: Any, pixmap: Any) -> Any |
X.insert(key, pixmap) -> PythonQt.QtGui.QPixmapCache::Key (shared captured text) |
remove |
function | (self, key: Any) -> None |
Removes the pixmap associated with key from the cache. (shared captured text) |
replace |
function | (self, key: Any, pixmap: Any) -> bool |
X.replace(key, pixmap) -> bool (shared captured text) |
setCacheLimit |
function | (self, arg__1: int) -> None |
Sets the cache limit to n kilobytes. (shared captured text) |