19#include <QtCore/qcoreapplication.h>
20#include <QtCore/qstring.h>
21#include <QtGui/qpixmap.h>
22#include <QtCore/qmutex.h>
23#include <QtCore/qurl.h>
24#include <private/qtquickglobal_p.h>
25#include <QtQuick/qquickimageprovider.h>
31class QQuickTextureFactory;
50 mutable bool imageDropped =
false;
66 UsePluginDefaultTransform = -1,
68 DoNotApplyTransform = 1
71 QQuickImageProviderOptions();
72 ~QQuickImageProviderOptions();
74 QQuickImageProviderOptions(
const QQuickImageProviderOptions&);
75 QQuickImageProviderOptions& operator=(
const QQuickImageProviderOptions&);
77 bool operator==(
const QQuickImageProviderOptions&)
const;
79 AutoTransform autoTransform()
const;
80 void setAutoTransform(AutoTransform autoTransform);
82 bool preserveAspectRatioCrop()
const;
83 void setPreserveAspectRatioCrop(
bool preserveAspectRatioCrop);
85 bool preserveAspectRatioFit()
const;
86 void setPreserveAspectRatioFit(
bool preserveAspectRatioFit);
88 QColorSpace targetColorSpace()
const;
89 void setTargetColorSpace(
const QColorSpace &colorSpace);
91 QRectF sourceClipRect()
const;
92 void setSourceClipRect(
const QRectF &rect);
95 QSharedDataPointer<QQuickImageProviderOptionsPrivate> d;
99
100
101
102
103
104
105
106
107
110 Q_DECLARE_TR_FUNCTIONS(QQuickPixmap)
112 enum Status { Null, Ready, Error, Loading };
118 Q_DECLARE_FLAGS(Options, Option)
122 QQuickPixmap(QQmlEngine *,
const QUrl &, Options options);
123 QQuickPixmap(QQmlEngine *,
const QUrl &,
const QRect ®ion,
const QSize &);
142 void setPixmap(
const QQuickPixmap &other);
155 void load(QQmlEngine *,
const QUrl &);
156 void load(QQmlEngine *,
const QUrl &, QQuickPixmap::Options options);
157 void load(QQmlEngine *,
const QUrl &,
const QRect &requestRegion,
const QSize &requestSize);
158 void load(QQmlEngine *,
const QUrl &,
const QRect &requestRegion,
const QSize &requestSize, QQuickPixmap::Options options);
159 void load(QQmlEngine *,
const QUrl &,
const QRect &requestRegion,
const QSize &requestSize,
160 QQuickPixmap::Options options,
const QQuickImageProviderOptions &providerOptions,
int frame = 0,
int frameCount = 1,
161 qreal devicePixelRatio = 1.0);
163 const QRect &requestRegion,
const QSize &requestSize,
164 const QQuickImageProviderOptions &providerOptions,
int frame = 0,
int frameCount = 1);
167 void clear(QObject *);
175 static bool isCached(
const QUrl &url,
const QRect &requestRegion,
const QSize &requestSize,
176 const int frame,
const QQuickImageProviderOptions &options);
182 Q_DISABLE_COPY(QQuickPixmap)
187Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickPixmap::Options)
191class Q_QUICK_EXPORT QQuickImageProviderWithOptions :
public QQuickAsyncImageProvider
194 QQuickImageProviderWithOptions(ImageType type, Flags flags = Flags());
196 QImage requestImage(
const QString &id, QSize *size,
const QSize& requestedSize) override;
197 QPixmap requestPixmap(
const QString &id, QSize *size,
const QSize& requestedSize) override;
198 QQuickTextureFactory *requestTexture(
const QString &id, QSize *size,
const QSize &requestedSize) override;
199 QQuickImageResponse *requestImageResponse(
const QString &id,
const QSize &requestedSize) override;
201 virtual QImage requestImage(
const QString &id, QSize *size,
const QSize& requestedSize,
const QQuickImageProviderOptions &options);
202 virtual QPixmap requestPixmap(
const QString &id, QSize *size,
const QSize& requestedSize,
const QQuickImageProviderOptions &options);
203 virtual QQuickTextureFactory *requestTexture(
const QString &id, QSize *size,
const QSize &requestedSize,
const QQuickImageProviderOptions &options);
204 virtual QQuickImageResponse *requestImageResponse(
const QString &id,
const QSize &requestedSize,
const QQuickImageProviderOptions &options);
206 static QSize loadSize(
const QSize &originalSize,
const QSize &requestedSize,
const QByteArray &format,
const QQuickImageProviderOptions &options,
207 qreal devicePixelRatio = 1.0);
208 static QQuickImageProviderWithOptions *checkedCast(QQuickImageProvider *provider);
bool autoTransform() const
ImageReaderError error() const
Returns the type of error that occurred last.
qreal width() const
Returns the width of the generated outlines.
bool isLoading() const
Returns true if the incubator's status() is Loading.
bool isError() const
Returns true if the incubator's status() is Error.
Status status() const
Return the current status of the incubator.
bool isReady() const
Returns true if the incubator's status() is Ready.
The QQuickAsyncImageProvider class provides an interface for asynchronous control of QML image reques...
QImage image() const override
Returns an image version of this texture.
QSize textureSize() const override
Returns the size of the texture.
int textureByteCount() const override
Returns the number of bytes of memory the texture consumes.
bool isImageDropped() const
QSGTexture * createTexture(QQuickWindow *window) const override
This function is called on the scene graph rendering thread to create a QSGTexture instance from the ...
QQuickImageProviderOptionsPrivate()
bool preserveAspectRatioFit
bool preserveAspectRatioCrop
QColorSpace targetColorSpace
QQuickImageProviderOptions::AutoTransform autoTransform
The QQuickImageProviderOptions class provides options for QQuickImageProviderWithOptions image reques...
bool isProviderWithOptions
The QQuickImageProvider class provides an interface for supporting pixmaps and threaded image request...
The QQuickImageResponse class provides an interface for asynchronous image loading in QQuickAsyncImag...
QColorSpace colorSpace() const
QQuickPixmap(QQmlEngine *, const QUrl &, const QRect ®ion, const QSize &)
QQuickPixmap(QQmlEngine *, const QUrl &, Options options)
void load(QQmlEngine *, const QUrl &, const QRect &requestRegion, const QSize &requestSize, QQuickPixmap::Options options, const QQuickImageProviderOptions &providerOptions, int frame=0, int frameCount=1, qreal devicePixelRatio=1.0)
bool connectDownloadProgress(QObject *, const char *)
static bool isScalableImageFormat(const QUrl &url)
QQuickTextureFactory * textureFactory() const
qreal devicePixelRatio() const
void load(QQmlEngine *, const QUrl &, QQuickPixmap::Options options)
const QSize & requestSize() const
void load(QQmlEngine *, const QUrl &, const QRect &requestRegion, const QSize &requestSize, QQuickPixmap::Options options)
QQuickPixmap(QQmlEngine *, const QUrl &)
QQuickPixmap(const QUrl &, const QImage &image)
static bool isCached(const QUrl &url, const QRect &requestRegion, const QSize &requestSize, const int frame, const QQuickImageProviderOptions &options)
void load(QQmlEngine *, const QUrl &)
void loadImageFromDevice(QQmlEngine *engine, QIODevice *device, const QUrl &url, const QRect &requestRegion, const QSize &requestSize, const QQuickImageProviderOptions &providerOptions, int frame=0, int frameCount=1)
const QRect & requestRegion() const
const QSize & implicitSize() const
void setImage(const QImage &)
void setPixmap(const QQuickPixmap &other)
static const QLatin1String itemGrabberScheme
void load(QQmlEngine *, const QUrl &, const QRect &requestRegion, const QSize &requestSize)
bool connectFinished(QObject *, const char *)
bool connectFinished(QObject *, int)
void removeDroppedTransientImageFromCache()
bool hasDroppedTransientImage() const
bool connectDownloadProgress(QObject *, int)
The QQuickTextureFactory class provides an interface for loading custom textures from QML....
void clear()
Clears the entire result set and releases any associated resources.
bool isNull() const noexcept
Returns true if there are zero numerical segments, otherwise returns false.
Combined button and popup list for selecting options.