diff options
-rw-r--r-- | src/declarative/util/qdeclarativepixmapcache.cpp | 14 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativepixmapcache_p.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index a29854f..831aa75 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -584,6 +584,7 @@ public: void unreferencePixmap(QDeclarativePixmapData *); void referencePixmap(QDeclarativePixmapData *); + void flushCache(); protected: virtual void timerEvent(QTimerEvent *); @@ -682,6 +683,14 @@ void QDeclarativePixmapStore::timerEvent(QTimerEvent *) } } +/* + Remove all unreferenced pixmaps from the cache. +*/ +void QDeclarativePixmapStore::flushCache() +{ + shrinkCache(m_unreferencedCost); +} + QDeclarativePixmapReply::QDeclarativePixmapReply(QDeclarativePixmapData *d) : data(d), reader(0), requestSize(d->requestSize), loading(false), redirectCount(0) { @@ -1075,6 +1084,11 @@ bool QDeclarativePixmap::connectDownloadProgress(QObject *object, int method) return QMetaObject::connect(d->reply, QDeclarativePixmapReply::downloadProgressIndex, object, method); } +void QDeclarativePixmap::flushCache() +{ + pixmapStore()->flushCache(); +} + QT_END_NAMESPACE #include <qdeclarativepixmapcache.moc> diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h index 1cf76dd..48c9f8b 100644 --- a/src/declarative/util/qdeclarativepixmapcache_p.h +++ b/src/declarative/util/qdeclarativepixmapcache_p.h @@ -103,6 +103,8 @@ public: bool connectDownloadProgress(QObject *, const char *); bool connectDownloadProgress(QObject *, int); + static void flushCache(); + private: Q_DISABLE_COPY(QDeclarativePixmap) QDeclarativePixmapData *d; |