Struct qt_gui::QPixmapCache

source ·
#[repr(C)]
pub struct QPixmapCache { /* private fields */ }
Expand description

The QPixmapCache class provides an application-wide cache for pixmaps.

C++ class: QPixmapCache.

C++ documentation:

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 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.

Implementations§

source§

impl QPixmapCache

source

pub unsafe fn cache_limit() -> c_int

Returns the cache limit (in kilobytes).

Calls C++ function: static int QPixmapCache::cacheLimit().

C++ documentation:

Returns the cache limit (in kilobytes).

The default cache limit is 10240 KB.

See also setCacheLimit().

source

pub unsafe fn clear()

Removes all pixmaps from the cache.

Calls C++ function: static void QPixmapCache::clear().

C++ documentation:

Removes all pixmaps from the cache.

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QPixmapCache>> ) -> Ref<QPixmapCache>

The QPixmapCache class provides an application-wide cache for pixmaps.

Calls C++ function: QPixmapCache& QPixmapCache::operator=(const QPixmapCache& other).

C++ documentation:

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 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.

source

pub unsafe fn find_q_string(key: impl CastInto<Ref<QString>>) -> Ptr<QPixmap>

Use bool find(const QString&, QPixmap*) instead.

Calls C++ function: static QPixmap* QPixmapCache::find(const QString& key).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for static bool QPixmapCache::find(const QString &key, QPixmap &pixmap):

Use bool find(const QString&, QPixmap*) instead.

source

pub unsafe fn find_q_string_q_pixmap( key: impl CastInto<Ref<QString>>, pixmap: impl CastInto<Ref<QPixmap>> ) -> bool

Use bool find(const QString&, QPixmap*) instead.

Calls C++ function: static bool QPixmapCache::find(const QString& key, QPixmap& pixmap).

C++ documentation:

Use bool find(const QString&, QPixmap*) instead.

source

pub unsafe fn find_q_string_q_pixmap2( key: impl CastInto<Ref<QString>>, pixmap: impl CastInto<Ptr<QPixmap>> ) -> bool

Use bool find(const QString&, QPixmap*) instead.

Calls C++ function: static bool QPixmapCache::find(const QString& key, QPixmap* pixmap).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for static bool QPixmapCache::find(const QString &key, QPixmap &pixmap):

Use bool find(const QString&, QPixmap*) instead.

source

pub unsafe fn find_key_q_pixmap( key: impl CastInto<Ref<Key>>, pixmap: impl CastInto<Ptr<QPixmap>> ) -> bool

Use bool find(const QString&, QPixmap*) instead.

Calls C++ function: static bool QPixmapCache::find(const QPixmapCache::Key& key, QPixmap* pixmap).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for static bool QPixmapCache::find(const QString &key, QPixmap &pixmap):

Use bool find(const QString&, QPixmap*) instead.

source

pub unsafe fn insert_2a( key: impl CastInto<Ref<QString>>, pixmap: impl CastInto<Ref<QPixmap>> ) -> bool

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

Calls C++ function: static bool QPixmapCache::insert(const QString& key, const QPixmap& pixmap).

C++ documentation:

Inserts a copy of the pixmap pixmap 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().

source

pub unsafe fn insert_1a(pixmap: impl CastInto<Ref<QPixmap>>) -> CppBox<Key>

Inserts a copy of the given pixmap into the cache and returns a key that can be used to retrieve it.

Calls C++ function: static QPixmapCache::Key QPixmapCache::insert(const QPixmap& pixmap).

C++ documentation:

Inserts a copy of the given pixmap into the cache and returns a key that can be used to retrieve it.

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.

This function was introduced in Qt 4.6.

See also setCacheLimit() and replace().

source

pub unsafe fn new() -> CppBox<QPixmapCache>

The QPixmapCache class provides an application-wide cache for pixmaps.

Calls C++ function: [constructor] void QPixmapCache::QPixmapCache().

C++ documentation:

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 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.

source

pub unsafe fn new_copy( other: impl CastInto<Ref<QPixmapCache>> ) -> CppBox<QPixmapCache>

The QPixmapCache class provides an application-wide cache for pixmaps.

Calls C++ function: [constructor] void QPixmapCache::QPixmapCache(const QPixmapCache& other).

C++ documentation:

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 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.

source

pub unsafe fn remove_q_string(key: impl CastInto<Ref<QString>>)

Removes the pixmap associated with key from the cache.

Calls C++ function: static void QPixmapCache::remove(const QString& key).

C++ documentation:

Removes the pixmap associated with key from the cache.

source

pub unsafe fn remove_key(key: impl CastInto<Ref<Key>>)

Removes the pixmap associated with key from the cache and releases the key for a future insertion.

Calls C++ function: static void QPixmapCache::remove(const QPixmapCache::Key& key).

C++ documentation:

Removes the pixmap associated with key from the cache and releases the key for a future insertion.

This function was introduced in Qt 4.6.

source

pub unsafe fn replace( key: impl CastInto<Ref<Key>>, pixmap: impl CastInto<Ref<QPixmap>> ) -> bool

Replaces the pixmap associated with the given key with the pixmap specified. Returns true if the pixmap has been correctly inserted into the cache; otherwise returns false.

Calls C++ function: static bool QPixmapCache::replace(const QPixmapCache::Key& key, const QPixmap& pixmap).

C++ documentation:

Replaces the pixmap associated with the given key with the pixmap specified. Returns true if the pixmap has been correctly inserted into the cache; otherwise returns false.

This function was introduced in Qt 4.6.

See also setCacheLimit() and insert().

source

pub unsafe fn set_cache_limit(arg1: c_int)

Sets the cache limit to n kilobytes.

Calls C++ function: static void QPixmapCache::setCacheLimit(int arg1).

C++ documentation:

Sets the cache limit to n kilobytes.

The default setting is 10240 KB.

See also cacheLimit().

Trait Implementations§

source§

impl CppDeletable for QPixmapCache

source§

unsafe fn delete(&self)

The QPixmapCache class provides an application-wide cache for pixmaps.

Calls C++ function: [destructor] void QPixmapCache::~QPixmapCache().

C++ documentation:

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 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.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.