43 #ifndef QT_NO_SVGRENDERER 69 {
return (((mode)<<4)|state); }
92 return ((((((size.
width()<<11)|size.
height())<<11)|mode)<<4)|state);
135 buf = svgBuffers->value(hashKey(mode, state));
140 #ifndef QT_NO_COMPRESS 145 QString svgFile = svgFiles.value(hashKey(mode, state));
149 renderer->
load(svgFile);
178 img.
fill(0x00000000);
214 #ifndef QT_NO_COMPRESS 258 #ifndef QT_NO_COMPRESS 265 qWarning(
"QSvgIconEngine: Can not decompress SVG data");
270 in >> hasAddedPixmaps;
271 if (hasAddedPixmaps) {
284 if (!data.isEmpty()) {
285 #ifndef QT_NO_COMPRESS 292 for (
int i=0; i<num_entries; ++i) {
310 int isCompressed = 0;
311 #ifndef QT_NO_COMPRESS 322 #ifndef QT_NO_COMPRESS 325 svgBuffers.
insert(key, buf);
327 out <<
d->
svgFiles << isCompressed << svgBuffers;
345 #ifndef QT_NO_COMPRESS 357 #endif // QT_NO_SVGRENDERER static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const =0
Returns a copy of the given pixmap, styled to conform to the specified iconMode and taking into accou...
QString key() const
Returns a key that identifies this icon engine.
The QPainter class performs low-level painting on widgets and other paint devices.
static int pmKey(const QSize &size, QIcon::Mode mode, QIcon::State state)
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
QString pmcKey(const QSize &size, QIcon::Mode mode, QIcon::State state)
#define QT_END_NAMESPACE
This macro expands to.
QSize size() const
Returns the size of the pixmap.
void clear()
Removes all items from the hash.
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state)
Returns the actual size of the icon the engine provides for the requested size, mode and state...
const QChar at(int i) const
Returns the character at the given index position in the string.
Q_CORE_EXPORT QByteArray qUncompress(const uchar *data, int nbytes)
The QAtomicInt class provides platform-independent atomic operations on integers. ...
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
static QAtomicInt lastSerialNum
bool atEnd() const
Returns true if the I/O device has reached the end position (end of the stream or file) or if there i...
void fill(uint pixel)
Fills the entire image with the given pixelValue.
The QByteArray class provides an array of bytes.
State
This enum describes the state for which a pixmap is intended to be used.
QString absoluteFilePath() const
Returns an absolute path including the file name.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QPalette palette()
Returns the application palette.
static QStyle * style()
Returns the application's style object.
The QString class provides a Unicode character string.
bool read(QDataStream &in)
Reads icon engine contents from the QDataStream in.
void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state)
Called by QIcon::addPixmap().
const T value(const Key &key) const
Returns the value associated with the key.
static QPixmap * find(const QString &key)
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
static int hashKey(QIcon::Mode mode, QIcon::State state)
int width() const
Returns the width.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QStyleOption class stores the parameters used by QStyle functions.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool isValid() const
Returns true if there is a valid current document; otherwise returns false.
QSize size() const
Returns the size of the rectangle.
Mode
This enum type describes the mode for which a pixmap is intended to be used.
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
static const char * data(const QByteArray &arr)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
QSize defaultSize() const
Returns the default size of the document contents.
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
Returns the icon as a pixmap with the required size, mode, and state.
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state)
Uses the given painter to paint the icon with the required mode and state into the rectangle rect...
The QIconEngineV2 class provides an abstract base class for QIcon renderers.
int version() const
Returns the version number of the data serialization format.
int fetchAndAddRelaxed(int valueToAdd)
Atomic fetch-and-add.
QPalette palette
the palette that should be used when painting the control
Q_CORE_EXPORT QByteArray qCompress(const uchar *data, int nbytes, int compressionLevel=-1)
QIconEngineV2 * clone() const
Returns a clone of this icon engine.
QString & append(QChar c)
The QSvgRenderer class is used to draw the contents of SVG files onto paint devices.
The QFile class provides an interface for reading from and writing to files.
The QSharedData class is a base class for shared data objects.
QHash< int, QPixmap > * addedPixmaps
void loadDataForModeAndState(QSvgRenderer *renderer, QIcon::Mode mode, QIcon::State state)
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
void render(QPainter *p)
Renders the current document, or the current frame of an animated document, using the given painter...
bool load(const QString &filename)
Loads the SVG file specified by filename, returning true if the content was successfully parsed; othe...
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
QByteArray readAll()
Reads all available data from the device, and returns it as a QByteArray.
QHash< int, QString > svgFiles
void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state)
Called by QIcon::addFile().
The QPixmap class is an off-screen image representation that can be used as a paint device...
void scale(int w, int h, Qt::AspectRatioMode mode)
Scales the size to a rectangle with the given width and height, according to the specified mode: ...
bool isNull() const
Returns true if both the width and height is 0; otherwise returns false.
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
The QSize class defines the size of a two-dimensional object using integer point precision.
The QDataStream class provides serialization of binary data to a QIODevice.
QSharedDataPointer< QSvgIconEnginePrivate > d
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
The QFileInfo class provides system-independent file information.
QHash< int, QByteArray > * svgBuffers
static QString fileName(const QString &fileUrl)
QList< Key > keys() const
Returns a list containing all the keys in the hash, in an arbitrary order.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
bool write(QDataStream &out) const
Writes the contents of this engine to the QDataStream out.