summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmapcache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/image/qpixmapcache.cpp')
-rw-r--r--src/gui/image/qpixmapcache.cpp38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 810ce65..82b42b4 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -128,6 +128,11 @@ bool QPixmapCache::Key::operator ==(const Key &key) const
}
/*!
+ \fn bool QPixmapCache::Key::operator !=(const Key &key) const
+ \internal
+*/
+
+/*!
\internal
*/
QPixmapCache::Key &QPixmapCache::Key::operator =(const Key &other)
@@ -183,7 +188,7 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include "qpixmapcache.moc"
QT_END_INCLUDE_NAMESPACE
-static uint qHash(const QPixmapCache::Key &k)
+uint qHash(const QPixmapCache::Key &k)
{
return qHash(QPMCache::get(k)->key);
}
@@ -337,8 +342,10 @@ bool QPMCache::remove(const QString &key)
bool QPMCache::remove(const QPixmapCache::Key &key)
{
+ bool result = QCache<QPixmapCache::Key, QDetachedPixmap>::remove(key);
+ //We release the key after we removed it from the cache
releaseKey(key);
- return QCache<QPixmapCache::Key, QDetachedPixmap>::remove(key);
+ return result;
}
void QPMCache::resizeKeyArray(int size)
@@ -431,8 +438,10 @@ bool QPixmapCache::find(const QString &key, QPixmap& pixmap)
/*!
Looks for a cached pixmap associated with the \a key in the cache.
- If the pixmap is found, the function sets \a pm to that pixmap and
- returns true; otherwise it leaves \a pm alone and returns false.
+ If the pixmap is found, the function sets \a pixmap to that pixmap and
+ returns true; otherwise it leaves \a pixmap alone and returns false.
+
+ \since 4.6
Example:
\snippet doc/src/snippets/code/src_gui_image_qpixmapcache.cpp 1
@@ -448,10 +457,12 @@ bool QPixmapCache::find(const QString &key, QPixmap* pixmap)
/*!
Looks for a cached pixmap associated with the \a key in the cache.
- If the pixmap is found, the function sets \a pm to that pixmap and
- returns true; otherwise it leaves \a pm alone and returns false. If
+ If the pixmap is found, the function sets \a pixmap to that pixmap and
+ returns true; otherwise it leaves \a pixmap alone and returns false. If
the pixmap is not found, it means that the \a key is not valid anymore,
so it will be released for the next insertion.
+
+ \since 4.6
*/
bool QPixmapCache::find(const Key &key, QPixmap* pixmap)
{
@@ -465,7 +476,7 @@ bool QPixmapCache::find(const Key &key, QPixmap* pixmap)
}
/*!
- Inserts a copy of the pixmap \a pm associated with the \a key into
+ Inserts a copy of the pixmap \a pixmap associated with the \a key into
the cache.
All pixmaps inserted by the Qt library have a key starting with
@@ -490,9 +501,8 @@ bool QPixmapCache::insert(const QString &key, const QPixmap &pixmap)
}
/*!
- Inserts a copy of the pixmap \a pm into
- the cache and return you the key. The key is always greater than 0.
- If the key is equals 0 then the insertion failed.
+ Inserts a copy of the pixmap \a pixmap into
+ the cache and return you the key.
When a pixmap is inserted and the cache is about to exceed its
limit, it removes pixmaps until there is enough room for the
@@ -502,6 +512,8 @@ bool QPixmapCache::insert(const QString &key, const QPixmap &pixmap)
deleted when more space is needed.
\sa setCacheLimit(), replace()
+
+ \since 4.6
*/
QPixmapCache::Key QPixmapCache::insert(const QPixmap &pixmap)
{
@@ -510,10 +522,12 @@ QPixmapCache::Key QPixmapCache::insert(const QPixmap &pixmap)
/*!
Replace the pixmap associated to the \a key into
- the cache. It return true if the pixmap \a pm has been correctly
+ the cache. It return true if the pixmap \a pixmap has been correctly
inserted into the cache false otherwise.
\sa setCacheLimit(), insert()
+
+ \since 4.6
*/
bool QPixmapCache::replace(const Key &key, const QPixmap &pixmap)
{
@@ -563,6 +577,8 @@ void QPixmapCache::remove(const QString &key)
/*!
Removes the pixmap associated with \a key from the cache and release
the key for a future insertion.
+
+ \since 4.6
*/
void QPixmapCache::remove(const Key &key)
{