From 8f68d15789c78c97a4cf1a2c85ec1753a2536032 Mon Sep 17 00:00:00 2001 From: Serge Lysenko Date: Fri, 21 Aug 2015 19:58:49 +0300 Subject: Add method for checking of QPixmapCache::Key validity We need a method to check whether a specified pixmap is still cached without touching the recently-accessed list for this pixmap. [ChangeLog][QtGui][QPixmapCache] Added QPixmapCache::Key::isValid(). Change-Id: I90fa4f67b569099b67b6207e78494beb3111b68e Reviewed-by: aavit --- src/gui/image/qpixmapcache.cpp | 10 ++++++++++ src/gui/image/qpixmapcache.h | 1 + 2 files changed, 11 insertions(+) (limited to 'src/gui/image') diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 71a79745e8..04e1d442b0 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -155,6 +155,16 @@ bool QPixmapCache::Key::operator ==(const Key &key) const \since 5.6 */ +/*! + Returns \c true if there is a cached pixmap associated with this key. + Otherwise, if pixmap was flushed, the key is no longer valid. + \since 5.7 +*/ +bool QPixmapCache::Key::isValid() const Q_DECL_NOTHROW +{ + return d && d->isValid; +} + /*! \internal */ diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h index 37a0588e06..ca18f299a7 100644 --- a/src/gui/image/qpixmapcache.h +++ b/src/gui/image/qpixmapcache.h @@ -59,6 +59,7 @@ public: Key &operator =(const Key &other); void swap(Key &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + bool isValid() const Q_DECL_NOTHROW; private: KeyData *d; -- cgit v1.2.3