Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4#ifndef QQUICKIMAGEPROVIDER_H
5#define QQUICKIMAGEPROVIDER_H
6
7#include <QtQuick/qtquickglobal.h>
8#include <QtGui/qimage.h>
9#include <QtGui/qpixmap.h>
10#include <QtQml/qqmlengine.h>
11
13
14
16class QQuickAsyncImageProviderPrivate;
18class QSGTexture;
19class QQuickWindow;
20
21class Q_QUICK_EXPORT QQuickTextureFactory : public QObject
22{
24public:
26 ~QQuickTextureFactory() override;
27
29 virtual QSize textureSize() const = 0;
30 virtual int textureByteCount() const = 0;
31 virtual QImage image() const;
32
33 static QQuickTextureFactory *textureFactoryForImage(const QImage &image);
34};
35
37
38class Q_QUICK_EXPORT QQuickImageResponse : public QObject
39{
41public:
43 ~QQuickImageResponse() override;
44
46 virtual QString errorString() const;
47
48public Q_SLOTS:
49 virtual void cancel();
50
52 void finished();
53
54private:
55 Q_DECLARE_PRIVATE(QQuickImageResponse)
56 Q_PRIVATE_SLOT(d_func(), void _q_finished())
57};
58
60
61class Q_QUICK_EXPORT QQuickImageProvider : public QQmlImageProviderBase
62{
65public:
67 ~QQuickImageProvider() override;
68
69 ImageType imageType() const override;
70 Flags flags() const override;
71
72 virtual QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize);
73 virtual QPixmap requestPixmap(const QString &id, QSize *size, const QSize& requestedSize);
74 virtual QQuickTextureFactory *requestTexture(const QString &id, QSize *size, const QSize &requestedSize);
75
76private:
78};
79
80class Q_QUICK_EXPORT QQuickAsyncImageProvider : public QQuickImageProvider
81{
82public:
85
86 virtual QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) = 0;
87
88private:
89 QQuickAsyncImageProviderPrivate *d;
90};
91
93
94#endif // QQUICKIMAGEPROVIDER_H
\inmodule QtGui
Definition qimage.h:37
\inmodule QtCore
Definition qobject.h:103
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
The QQmlImageProviderBase class is used to register image providers in the QML engine.
Definition qqmlengine.h:18
ImageType
Defines the type of image supported by this image provider.
Definition qqmlengine.h:21
The QQuickAsyncImageProvider class provides an interface for asynchronous control of QML image reques...
virtual QQuickImageResponse * requestImageResponse(const QString &id, const QSize &requestedSize)=0
Implement this method to return the job that will provide the texture with id.
The QQuickImageProviderOptions class provides options for QQuickImageProviderWithOptions image reques...
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...
void finished()
Signals that the job execution has finished (be it successfully, because an error happened or because...
virtual QQuickTextureFactory * textureFactory() const =0
Returns the texture factory for the job.
The QQuickTextureFactory class provides an interface for loading custom textures from QML....
virtual QSize textureSize() const =0
Returns the size of the texture.
virtual int textureByteCount() const =0
Returns the number of bytes of memory the texture consumes.
virtual QSGTexture * createTexture(QQuickWindow *window) const =0
This function is called on the scene graph rendering thread to create a QSGTexture instance from the ...
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
\inmodule QtQuick
Definition qsgtexture.h:20
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
Definition image.cpp:4
Flags
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum type
GLbitfield flags
#define Q_OBJECT
#define Q_SLOTS
#define Q_PRIVATE_SLOT(d, signature)
#define Q_SIGNALS
future cancel()
aWidget window() -> setWindowTitle("New Window Title")
[2]