Qt 4.8
Public Functions | Static Public Functions | Public Variables | Static Public Variables | List of all members
QSvgIconEnginePrivate Class Reference
Inheritance diagram for QSvgIconEnginePrivate:
QSharedData

Public Functions

void loadDataForModeAndState (QSvgRenderer *renderer, QIcon::Mode mode, QIcon::State state)
 
QString pmcKey (const QSize &size, QIcon::Mode mode, QIcon::State state)
 
 QSvgIconEnginePrivate ()
 
void stepSerialNum ()
 
 ~QSvgIconEnginePrivate ()
 
- Public Functions inherited from QSharedData
 QSharedData ()
 Constructs a QSharedData object with a reference count of 0. More...
 
 QSharedData (const QSharedData &)
 Constructs a QSharedData object with reference count 0. More...
 

Static Public Functions

static int hashKey (QIcon::Mode mode, QIcon::State state)
 

Public Variables

QHash< int, QPixmap > * addedPixmaps
 
int serialNum
 
QHash< int, QByteArray > * svgBuffers
 
QHash< int, QStringsvgFiles
 
- Public Variables inherited from QSharedData
QAtomicInt ref
 

Static Public Variables

static QAtomicInt lastSerialNum
 

Detailed Description

Definition at line 58 of file qsvgiconengine.cpp.

Constructors and Destructors

◆ QSvgIconEnginePrivate()

QSvgIconEnginePrivate::QSvgIconEnginePrivate ( )
inline

Definition at line 61 of file qsvgiconengine.cpp.

62  : svgBuffers(0), addedPixmaps(0)
63  { stepSerialNum(); }
QHash< int, QPixmap > * addedPixmaps
QHash< int, QByteArray > * svgBuffers

◆ ~QSvgIconEnginePrivate()

QSvgIconEnginePrivate::~QSvgIconEnginePrivate ( )
inline

Definition at line 65 of file qsvgiconengine.cpp.

66  { delete addedPixmaps; delete svgBuffers; }
QHash< int, QPixmap > * addedPixmaps
QHash< int, QByteArray > * svgBuffers

Functions

◆ hashKey()

static int QSvgIconEnginePrivate::hashKey ( QIcon::Mode  mode,
QIcon::State  state 
)
inlinestatic

◆ loadDataForModeAndState()

void QSvgIconEnginePrivate::loadDataForModeAndState ( QSvgRenderer renderer,
QIcon::Mode  mode,
QIcon::State  state 
)

Definition at line 131 of file qsvgiconengine.cpp.

Referenced by QSvgIconEngine::pixmap(), and stepSerialNum().

132 {
133  QByteArray buf;
134  if (svgBuffers) {
135  buf = svgBuffers->value(hashKey(mode, state));
136  if (buf.isEmpty())
138  }
139  if (!buf.isEmpty()) {
140 #ifndef QT_NO_COMPRESS
141  buf = qUncompress(buf);
142 #endif
143  renderer->load(buf);
144  } else {
145  QString svgFile = svgFiles.value(hashKey(mode, state));
146  if (svgFile.isEmpty())
148  if (!svgFile.isEmpty())
149  renderer->load(svgFile);
150  }
151 }
Q_CORE_EXPORT QByteArray qUncompress(const uchar *data, int nbytes)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
The QString class provides a Unicode character string.
Definition: qstring.h:83
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
static int hashKey(QIcon::Mode mode, QIcon::State state)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
bool load(const QString &filename)
Loads the SVG file specified by filename, returning true if the content was successfully parsed; othe...
QHash< int, QString > svgFiles
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
QHash< int, QByteArray > * svgBuffers

◆ pmcKey()

QString QSvgIconEnginePrivate::pmcKey ( const QSize size,
QIcon::Mode  mode,
QIcon::State  state 
)
inline

Definition at line 71 of file qsvgiconengine.cpp.

Referenced by QSvgIconEngine::pixmap().

72  { return QLatin1String("$qt_svgicon_")
74  + QString::number((((((size.width()<<11)|size.height())<<11)|mode)<<4)|state, 16); }
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int width() const
Returns the width.
Definition: qsize.h:126
QString & append(QChar c)
Definition: qstring.cpp:1777
int height() const
Returns the height.
Definition: qsize.h:129
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ stepSerialNum()

void QSvgIconEnginePrivate::stepSerialNum ( )
inline

Definition at line 76 of file qsvgiconengine.cpp.

Referenced by QSvgIconEngine::addFile(), QSvgIconEngine::addPixmap(), and QSvgIconEnginePrivate().

static QAtomicInt lastSerialNum
int fetchAndAddRelaxed(int valueToAdd)
Atomic fetch-and-add.

Properties

◆ addedPixmaps

QHash<int, QPixmap>* QSvgIconEnginePrivate::addedPixmaps

◆ lastSerialNum

QAtomicInt QSvgIconEnginePrivate::lastSerialNum
static

Definition at line 85 of file qsvgiconengine.cpp.

Referenced by stepSerialNum().

◆ serialNum

int QSvgIconEnginePrivate::serialNum

Definition at line 84 of file qsvgiconengine.cpp.

Referenced by pmcKey(), and stepSerialNum().

◆ svgBuffers

QHash<int, QByteArray>* QSvgIconEnginePrivate::svgBuffers

◆ svgFiles

QHash<int, QString> QSvgIconEnginePrivate::svgFiles

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