Qt 4.8
Public Functions | Properties | Friends | List of all members
QPixmapCache::Key Class Reference

The QPixmapCache::Key class can be used for efficient access to the QPixmapCache. More...

#include <qpixmapcache.h>

Public Functions

 Key ()
 Constructs an empty Key object. More...
 
 Key (const Key &other)
 Constructs a copy of other. More...
 
bool operator!= (const Key &key) const
 
Keyoperator= (const Key &other)
 
bool operator== (const Key &key) const
 Returns true if this key is the same as the given key; otherwise returns false. More...
 
 ~Key ()
 Destroys the key. More...
 

Properties

KeyDatad
 

Friends

class QPixmapCache
 
class QPMCache
 

Detailed Description

The QPixmapCache::Key class can be used for efficient access to the QPixmapCache.

Since
4.6

Use QPixmapCache::insert() to receive an instance of Key generated by the pixmap cache. You can store the key in your own objects for a very efficient one-to-one object-to-pixmap mapping.

Definition at line 61 of file qpixmapcache.h.

Constructors and Destructors

◆ Key() [1/2]

QPixmapCache::Key::Key ( )

Constructs an empty Key object.

Definition at line 119 of file qpixmapcache.cpp.

119  : d(0)
120 {
121 }

◆ Key() [2/2]

QPixmapCache::Key::Key ( const Key other)

Constructs a copy of other.

Warning
This function is not part of the public interface.

Definition at line 130 of file qpixmapcache.cpp.

131 {
132  if (other.d)
133  ++(other.d->ref);
134  d = other.d;
135 }

◆ ~Key()

QPixmapCache::Key::~Key ( )

Destroys the key.

Definition at line 140 of file qpixmapcache.cpp.

141 {
142  if (d && --(d->ref) == 0)
143  delete d;
144 }

Functions

◆ operator!=()

bool QPixmapCache::Key::operator!= ( const Key key) const
inline
Warning
This function is not part of the public interface.

Definition at line 68 of file qpixmapcache.h.

69  { return !operator==(key); }
bool operator==(const Key &key) const
Returns true if this key is the same as the given key; otherwise returns false.
int key

◆ operator=()

QPixmapCache::Key & QPixmapCache::Key::operator= ( const Key other)
Warning
This function is not part of the public interface.

Definition at line 168 of file qpixmapcache.cpp.

169 {
170  if (d != other.d) {
171  if (other.d)
172  ++(other.d->ref);
173  if (d && --(d->ref) == 0)
174  delete d;
175  d = other.d;
176  }
177  return *this;
178 }

◆ operator==()

bool QPixmapCache::Key::operator== ( const Key key) const

Returns true if this key is the same as the given key; otherwise returns false.

Warning
This function is not part of the public interface.

Definition at line 155 of file qpixmapcache.cpp.

156 {
157  return (d == key.d);
158 }
int key

Friends and Related Functions

◆ QPixmapCache

friend class QPixmapCache
friend

Definition at line 75 of file qpixmapcache.h.

◆ QPMCache

friend class QPMCache
friend

Definition at line 74 of file qpixmapcache.h.

Properties

◆ d

KeyData* QPixmapCache::Key::d
private

The documentation for this class was generated from the following files: