Warning, file /include/QtGui/qpixmapcache.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QPIXMAPCACHE_H
0005 #define QPIXMAPCACHE_H
0006
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtGui/qpixmap.h>
0009
0010 QT_BEGIN_NAMESPACE
0011
0012
0013 class Q_GUI_EXPORT QPixmapCache
0014 {
0015 public:
0016 class KeyData;
0017 class Q_GUI_EXPORT Key
0018 {
0019 public:
0020 Key();
0021 Key(const Key &other);
0022 Key(Key &&other) noexcept : d(other.d) { other.d = nullptr; }
0023 Key &operator =(Key &&other) noexcept { swap(other); return *this; }
0024 ~Key();
0025 bool operator ==(const Key &key) const;
0026 inline bool operator !=(const Key &key) const
0027 { return !operator==(key); }
0028 Key &operator =(const Key &other);
0029
0030 void swap(Key &other) noexcept { qt_ptr_swap(d, other.d); }
0031 bool isValid() const noexcept;
0032
0033 private:
0034 friend size_t qHash(const QPixmapCache::Key &k, size_t seed = 0) noexcept
0035 { return k.hash(seed); }
0036 size_t hash(size_t seed) const noexcept;
0037
0038 KeyData *d;
0039 friend class QPMCache;
0040 friend class QPixmapCache;
0041 };
0042
0043 static int cacheLimit();
0044 static void setCacheLimit(int);
0045 static bool find(const QString &key, QPixmap *pixmap);
0046 static bool find(const Key &key, QPixmap *pixmap);
0047 static bool insert(const QString &key, const QPixmap &pixmap);
0048 static Key insert(const QPixmap &pixmap);
0049 #if QT_DEPRECATED_SINCE(6, 6)
0050 QT_DEPRECATED_VERSION_X_6_6("Use remove(key), followed by key = insert(pixmap).")
0051 QT_GUI_INLINE_SINCE(6, 6)
0052 static bool replace(const Key &key, const QPixmap &pixmap);
0053 #endif
0054 static void remove(const QString &key);
0055 static void remove(const Key &key);
0056 static void clear();
0057 };
0058 Q_DECLARE_SHARED(QPixmapCache::Key)
0059
0060 #if QT_DEPRECATED_SINCE(6, 6)
0061 #if QT_GUI_INLINE_IMPL_SINCE(6, 6)
0062 bool QPixmapCache::replace(const Key &key, const QPixmap &pixmap)
0063 {
0064 if (!key.isValid())
0065 return false;
0066 remove(key);
0067 const_cast<Key&>(key) = insert(pixmap);
0068 return key.isValid();
0069 }
0070 #endif
0071 #endif
0072
0073 QT_END_NAMESPACE
0074
0075 #endif