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
qquickimageprovider.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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKIMAGEPROVIDER_H
6#define QQUICKIMAGEPROVIDER_H
7
8#include <QtQuick/qtquickglobal.h>
9#include <QtGui/qimage.h>
10#include <QtGui/qpixmap.h>
11#include <QtQml/qqmlengine.h>
12
13QT_BEGIN_NAMESPACE
14
15
16class QQuickImageProviderPrivate;
17class QQuickAsyncImageProviderPrivate;
19class QSGTexture;
20class QQuickWindow;
21
22class Q_QUICK_EXPORT QQuickTextureFactory : public QObject
23{
24 Q_OBJECT
25public:
26 QQuickTextureFactory();
27 ~QQuickTextureFactory() override;
28
29 virtual QSGTexture *createTexture(QQuickWindow *window) const = 0;
30 virtual QSize textureSize() const = 0;
31 virtual int textureByteCount() const = 0;
32 virtual QImage image() const;
33
34 static QQuickTextureFactory *textureFactoryForImage(const QImage &image);
35};
36
38
39class Q_QUICK_EXPORT QQuickImageResponse : public QObject
40{
41Q_OBJECT
42public:
43 QQuickImageResponse();
44 ~QQuickImageResponse() override;
45
46 virtual QQuickTextureFactory *textureFactory() const = 0;
47 virtual QString errorString() const;
48
49public Q_SLOTS:
50 virtual void cancel();
51
52Q_SIGNALS:
53 void finished();
54
55private:
56 Q_DECLARE_PRIVATE(QQuickImageResponse)
57 Q_PRIVATE_SLOT(d_func(), void _q_finished())
58};
59
60class QQuickImageProviderOptions;
61
62class Q_QUICK_EXPORT QQuickImageProvider : public QQmlImageProviderBase
63{
64 friend class QQuickImageProviderWithOptions;
65 Q_OBJECT
66public:
67 QQuickImageProvider(ImageType type, Flags flags = Flags());
68 ~QQuickImageProvider() override;
69
70 ImageType imageType() const override;
71 Flags flags() const override;
72
73 virtual QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize);
74 virtual QPixmap requestPixmap(const QString &id, QSize *size, const QSize& requestedSize);
75 virtual QQuickTextureFactory *requestTexture(const QString &id, QSize *size, const QSize &requestedSize);
76
77private:
78 QQuickImageProviderPrivate *d;
79};
80
81class Q_QUICK_EXPORT QQuickAsyncImageProvider : public QQuickImageProvider
82{
83public:
84 QQuickAsyncImageProvider();
85 ~QQuickAsyncImageProvider() override;
86
87 virtual QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) = 0;
88
89private:
90 QQuickAsyncImageProviderPrivate *d;
91};
92
93QT_END_NAMESPACE
94
95#endif // QQUICKIMAGEPROVIDER_H
The QQuickAsyncImageProvider class provides an interface for asynchronous control of QML image reques...
QQuickImageProviderOptions::AutoTransform autoTransform
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...
The QQuickTextureFactory class provides an interface for loading custom textures from QML....