42 #define Q_TEST_QPIXMAPCACHE 96 #if defined(Q_WS_QWS) || defined(Q_WS_WINCE) 142 if (
d && --(
d->
ref) == 0)
173 if (
d && --(
d->
ref) == 0)
194 void resizeKeyArray(
int size);
208 bool flushDetachedPixmaps(
bool nt);
211 enum { soon_time = 10000, flush_time = 30000 };
222 #include "qpixmapcache.moc" 233 keyArray(0), theid(0), ps(0), keyArraySize(0), freeKey(0), t(false)
284 }
else if (nt !=
t) {
295 if (!cacheKey.
d || !cacheKey.
d->
isValid) {
402 size *
sizeof(
int))));
439 for (
int i = 0; i < keys.
size(); ++i)
469 return pm_cache()->size();
474 pm_cache()->releaseKey(
key);
495 return pm_cache()->object(key);
507 return find(key, &pixmap);
571 return pm_cache()->insert(key, pixmap, pixmap.
width() * pixmap.
height() * pixmap.
depth() / 8);
591 return pm_cache()->insert(pixmap, pixmap.
width() * pixmap.
height() * pixmap.
depth() / 8);
608 return pm_cache()->replace(key, pixmap, pixmap.
width() * pixmap.
height() * pixmap.
depth() / 8);
645 pm_cache()->remove(key);
659 pm_cache()->remove(key);
670 }
QT_CATCH(
const std::bad_alloc &) {
676 void QPixmapCache::flushDetachedPixmaps()
678 pm_cache()->flushDetachedPixmaps(
true);
681 int QPixmapCache::totalUsed()
683 return (pm_cache()->
totalCost()+1023) / 1024;
688 return pm_cache()->allPixmaps();
static QPixmapCache::KeyData * get(const QPixmapCache::Key &key)
static int cacheLimit()
Returns the cache limit (in kilobytes).
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
uint qHash(const QPixmapCache::Key &k)
T * object(const Key &key) const
#define QT_END_NAMESPACE
This macro expands to.
int width() const
Returns the width of the pixmap.
int remove(const Key &key)
Removes all the items that have the key from the hash.
#define it(className, varName)
bool replace(const QPixmapCache::Key &key, const QPixmap &pixmap, int cost)
void resizeKeyArray(int size)
#define QT_END_INCLUDE_NAMESPACE
This macro is equivalent to QT_BEGIN_NAMESPACE.
QPixmapCache::Key createKey()
int depth() const
Returns the depth of the pixmap.
The QString class provides a Unicode character string.
bool operator==(const Key &key) const
Returns true if this key is the same as the given key; otherwise returns false.
The QObject class is the base class of all Qt objects.
bool insert(const QString &key, const QPixmap &pixmap, int cost)
const T value(const Key &key) const
Returns the value associated with the key.
static QPixmap * find(const QString &key)
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
static QPixmapCache::KeyData * getKeyData(QPixmapCache::Key *key)
void append(const T &t)
Inserts value at the end of the list.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void timerEvent(QTimerEvent *)
This event handler can be reimplemented in a subclass to receive timer events for the object...
void releaseKey(const QPixmapCache::Key &key)
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
const T & at(int i) const
Returns the item at index position i in the list.
static void clear()
Removes all pixmaps from the cache.
const T * ptr(const T &t)
bool flushDetachedPixmaps(bool nt)
Key & operator=(const Key &other)
QHash< QString, QPixmapCache::Key > cacheKeys
bool insert(const Key &key, T *object, int cost=1)
int Q_AUTOTEST_EXPORT q_QPixmapCache_keyHashSize()
bool contains(const QPixmapCache::Key &key) const
The QPixmapCache::Key class can be used for efficient access to the QPixmapCache. ...
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
The QTimerEvent class contains parameters that describe a timer event.
Key()
Constructs an empty Key object.
QList< QPair< QString, QPixmap > > allPixmaps() const
bool remove(const QString &key)
const Key key(const T &value) const
Returns the first key mapped to value.
static bool replace(const Key &key, const QPixmap &pixmap)
Replaces the pixmap associated with the given key with the pixmap specified.
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
int size() const
Returns the number of items in the list.
static void setCacheLimit(int)
Sets the cache limit to n kilobytes.
#define Q_AUTOTEST_EXPORT
iterator begin()
Returns an STL-style iterator pointing to the first item in the hash.
The QPixmap class is an off-screen image representation that can be used as a paint device...
QList< QPixmapCache::Key > keys() const
#define QT_BEGIN_INCLUDE_NAMESPACE
This macro is equivalent to QT_END_NAMESPACE.
int height() const
Returns the height of the pixmap.
static void remove(const QString &key)
Removes the pixmap associated with key from the cache.
iterator erase(iterator it)
Removes the (key, value) pair associated with the iterator pos from the hash, and returns an iterator...
The QPixmapCache class provides an application-wide cache for pixmaps.
bool remove(const Key &key)
The QList class is a template class that provides lists.
QPixmap * object(const QString &key) const
void killTimer(int id)
Kills the timer with timer identifier, id.