Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qimagereader.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QIMAGEREADER_H
5#define QIMAGEREADER_H
6
7#include <QtGui/qtguiglobal.h>
8#include <QtCore/qbytearray.h>
9#include <QtCore/qcoreapplication.h>
10#include <QtGui/qimage.h>
11#include <QtGui/qimageiohandler.h>
12
14
15
16class QColor;
17class QIODevice;
18class QRect;
19class QSize;
20
22class Q_GUI_EXPORT QImageReader
23{
24 Q_DECLARE_TR_FUNCTIONS(QImageReader)
25public:
26 enum ImageReaderError {
27 UnknownError,
28 FileNotFoundError,
29 DeviceError,
30 UnsupportedFormatError,
31 InvalidDataError
32 };
33
35 explicit QImageReader(QIODevice *device, const QByteArray &format = QByteArray());
36 explicit QImageReader(const QString &fileName, const QByteArray &format = QByteArray());
37 ~QImageReader();
38
39 void setFormat(const QByteArray &format);
40 QByteArray format() const;
41
42 void setAutoDetectImageFormat(bool enabled);
43 bool autoDetectImageFormat() const;
44
45 void setDecideFormatFromContent(bool ignored);
46 bool decideFormatFromContent() const;
47
48 void setDevice(QIODevice *device);
49 QIODevice *device() const;
50
51 void setFileName(const QString &fileName);
52 QString fileName() const;
53
54 QSize size() const;
55
56 QImage::Format imageFormat() const;
57
58 QStringList textKeys() const;
59 QString text(const QString &key) const;
60
61 void setClipRect(const QRect &rect);
62 QRect clipRect() const;
63
64 void setScaledSize(const QSize &size);
65 QSize scaledSize() const;
66
67 void setQuality(int quality);
68 int quality() const;
69
70 void setScaledClipRect(const QRect &rect);
71 QRect scaledClipRect() const;
72
73 void setBackgroundColor(const QColor &color);
74 QColor backgroundColor() const;
75
76 bool supportsAnimation() const;
77
79
80 void setAutoTransform(bool enabled);
81 bool autoTransform() const;
82
83 QByteArray subType() const;
85
86 bool canRead() const;
87 QImage read();
88 bool read(QImage *image);
89
90 bool jumpToNextImage();
91 bool jumpToImage(int imageNumber);
92 int loopCount() const;
93 int imageCount() const;
94 int nextImageDelay() const;
95 int currentImageNumber() const;
96 QRect currentImageRect() const;
97
98 ImageReaderError error() const;
99 QString errorString() const;
100
101 bool supportsOption(QImageIOHandler::ImageOption option) const;
102
103 static QByteArray imageFormat(const QString &fileName);
104 static QByteArray imageFormat(QIODevice *device);
107 static QList<QByteArray> imageFormatsForMimeType(const QByteArray &mimeType);
108 static int allocationLimit();
109 static void setAllocationLimit(int mbLimit);
110
111private:
112 Q_DISABLE_COPY(QImageReader)
113 QImageReaderPrivate *d;
114};
115
116QT_END_NAMESPACE
117
118#endif // QIMAGEREADER_H
The QIconEngine class provides an abstract base class for QIcon renderers.
Definition qiconengine.h:15
QAtomicInt ref
Definition qicon_p.h:41
QIconEngine * engine
Definition qicon_p.h:39
int serialNum
Definition qicon_p.h:42
bool is_mask
Definition qicon_p.h:44
QIconPrivate(QIconEngine *e)
Definition qicon.cpp:131
~QIconPrivate()
Definition qicon_p.h:33
int detach_no
Definition qicon_p.h:43
static void clearIconCache()
Definition qicon.cpp:139
static qreal pixmapDevicePixelRatio(qreal displayDevicePixelRatio, const QSize &requestedSize, const QSize &actualSize)
Definition qicon.cpp:155
The QImageReader class provides a format independent interface for reading images from files or other...
void setScaledClipRect(const QRect &rect)
Sets the scaled clip rect to rect.
QString errorString() const
Returns a human readable description of the last error that occurred.
bool decideFormatFromContent() const
Returns whether the image reader should decide which plugin to use only based on the contents of the ...
int imageCount() const
For image formats that support animation, this function returns the total number of images in the ani...
void setDevice(QIODevice *device)
Sets QImageReader's device to device.
bool autoTransform() const
bool autoDetectImageFormat() const
Returns true if image format autodetection is enabled on this image reader; otherwise returns false.
static QList< QByteArray > supportedMimeTypes()
Returns the list of MIME types supported by QImageReader.
int quality() const
Returns the quality setting of the image format.
QSize scaledSize() const
Returns the scaled size of the image.
QString fileName() const
If the currently assigned device is a QFile, or if setFileName() has been called, this function retur...
void setFileName(const QString &fileName)
Sets the file name of QImageReader to fileName.
void setScaledSize(const QSize &size)
Sets the scaled size of the image to size.
QImageIOHandler::Transformations transformation() const
QIODevice * device() const
Returns the device currently assigned to QImageReader, or \nullptr if no device has been assigned.
QByteArray subType() const
QColor backgroundColor() const
Returns the background color that's used when reading an image.
static void setAllocationLimit(int mbLimit)
QImageReader(const QString &fileName, const QByteArray &format=QByteArray())
Constructs a QImageReader object with the file name fileName and the image format format.
QRect currentImageRect() const
For image formats that support animation, this function returns the rect for the current frame.
bool supportsAnimation() const
Returns true if the image format supports animation; otherwise, false is returned.
void setDecideFormatFromContent(bool ignored)
If ignored is set to true, then the image reader will ignore specified formats or file extensions and...
void setAutoTransform(bool enabled)
QString text(const QString &key) const
Returns the image text associated with key.
bool jumpToImage(int imageNumber)
For image formats that support animation, this function skips to the image whose sequence number is i...
QRect clipRect() const
Returns the clip rect (also known as the ROI, or Region Of Interest) of the image.
static QByteArray imageFormat(QIODevice *device)
If supported, this function returns the image format of the device device.
QImageReader()
Constructs an empty QImageReader object.
bool supportsOption(QImageIOHandler::ImageOption option) const
Returns true if the reader supports option; otherwise returns false.
static int allocationLimit()
QList< QByteArray > supportedSubTypes() const
QImageReader(QIODevice *device, const QByteArray &format=QByteArray())
Constructs a QImageReader object with the device device and the image format format.
static QList< QByteArray > imageFormatsForMimeType(const QByteArray &mimeType)
QByteArray format() const
Returns the format QImageReader uses for reading images.
bool canRead() const
Returns true if an image can be read for the device (i.e., the image format is supported,...
static QList< QByteArray > supportedImageFormats()
Returns the list of image formats supported by QImageReader.
void setQuality(int quality)
Sets the quality setting of the image format to quality.
void setBackgroundColor(const QColor &color)
Sets the background color to color.
bool jumpToNextImage()
For image formats that support animation, this function steps over the current image,...
void setFormat(const QByteArray &format)
Sets the format QImageReader will use when reading images, to format.
QSize size() const
Returns the size of the image, without actually reading the image contents.
void setClipRect(const QRect &rect)
Sets the image clip rect (also known as the ROI, or Region Of Interest) to rect.
void setAutoDetectImageFormat(bool enabled)
If enabled is true, image format autodetection is enabled; otherwise, it is disabled.
int currentImageNumber() const
For image formats that support animation, this function returns the sequence number of the current fr...
ImageReaderError error() const
Returns the type of error that occurred last.
bool read(QImage *image)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QRect scaledClipRect() const
Returns the scaled clip rect of the image.
int nextImageDelay() const
For image formats that support animation, this function returns the number of milliseconds to wait un...
QStringList textKeys() const
Returns the text keys for this image.
int loopCount() const
For image formats that support animation, this function returns the number of times the animation sho...
QImage::Format imageFormat() const
Returns the format of the image, without actually reading the image contents.
QImage read()
Reads an image from the device.
static QByteArray imageFormat(const QString &fileName)
If supported, this function returns the image format of the file fileName.
QDataStream & operator>>(QDataStream &s, QKeyCombination &combination)
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
static void qt_cleanup_icon_cache()
Definition qicon.cpp:126
static constexpr auto themeIconMapping
Definition qicon.cpp:1476
static int origIcoDepth(const QImage &image)
Definition qicon.cpp:439
static qint64 area(const QSize &s)
Definition qicon.cpp:190
static int nextSerialNumCounter()
Definition qicon.cpp:106
static QIconEngine * iconEngineFromSuffix(const QString &fileName, const QString &suffix)
Definition qicon.cpp:1132
QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio, qreal *sourceDevicePixelRatio)
Definition qicon.cpp:2053
static int findBySize(const QList< QImage > &images, const QSize &size)
Definition qicon.cpp:445
static QPixmapIconEngineEntry * bestSizeScaleMatch(const QSize &size, qreal scale, QPixmapIconEngineEntry *pa, QPixmapIconEngineEntry *pb)
Definition qicon.cpp:198
static constexpr QLatin1StringView themeIconName(QIcon::ThemeIcon icon)
Definition qicon.cpp:1632
Q_DECLARE_TYPEINFO(QPixmapIconEngineEntry, Q_RELOCATABLE_TYPE)
#define QIconEngineFactoryInterface_iid
Q_GLOBAL_STATIC_WITH_ARGS(PermissionStatusHash, g_permissionStatusHash,({ { qMetaTypeId< QCameraPermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QMicrophonePermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QBluetoothPermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QContactsPermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QCalendarPermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QLocationPermission >(), Qt::PermissionStatus::Undetermined } }))
QPixmapIconEngineEntry(const QPixmap &pm, QIcon::Mode m, QIcon::State s)
Definition qicon_p.h:53
QPixmapIconEngineEntry()=default
QPixmapIconEngineEntry(const QString &file, const QSize &sz, QIcon::Mode m, QIcon::State s)
Definition qicon_p.h:55