summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/quick/imageresponseprovider/imageresponseprovider.cpp16
-rw-r--r--src/quick/util/qquickimageprovider.cpp4
2 files changed, 12 insertions, 8 deletions
diff --git a/examples/quick/imageresponseprovider/imageresponseprovider.cpp b/examples/quick/imageresponseprovider/imageresponseprovider.cpp
index a888c823a6..d4633b779a 100644
--- a/examples/quick/imageresponseprovider/imageresponseprovider.cpp
+++ b/examples/quick/imageresponseprovider/imageresponseprovider.cpp
@@ -51,37 +51,37 @@ class AsyncImageResponse : public QQuickImageResponse, public QRunnable
{
public:
AsyncImageResponse(const QString &id, const QSize &requestedSize)
- : m_id(id), m_requestedSize(requestedSize), m_texture(0)
+ : m_id(id), m_requestedSize(requestedSize)
{
setAutoDelete(false);
}
QQuickTextureFactory *textureFactory() const
{
- return m_texture;
+ return QQuickTextureFactory::textureFactoryForImage(m_image);
}
void run()
{
- QImage image(50, 50, QImage::Format_RGB32);
+ m_image = QImage(50, 50, QImage::Format_RGB32);
if (m_id == "slow") {
qDebug() << "Slow, red, sleeping for 5 seconds";
QThread::sleep(5);
- image.fill(Qt::red);
+ m_image.fill(Qt::red);
} else {
qDebug() << "Fast, blue, sleeping for 1 second";
QThread::sleep(1);
- image.fill(Qt::blue);
+ m_image.fill(Qt::blue);
}
if (m_requestedSize.isValid())
- image = image.scaled(m_requestedSize);
- m_texture = QQuickTextureFactory::textureFactoryForImage(image);
+ m_image = m_image.scaled(m_requestedSize);
+
emit finished();
}
QString m_id;
QSize m_requestedSize;
- QQuickTextureFactory *m_texture;
+ QImage m_image;
};
class AsyncImageProvider : public QQuickAsyncImageProvider
diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp
index 0c245d2b23..d2a8a5097c 100644
--- a/src/quick/util/qquickimageprovider.cpp
+++ b/src/quick/util/qquickimageprovider.cpp
@@ -158,6 +158,8 @@ QQuickTextureFactory *QQuickTextureFactory::textureFactoryForImage(const QImage
If you are using QRunnable as base for your QQuickImageResponse
ensure automatic deletion is disabled.
+ See the \l {imageresponseprovider}{Image Response Provider Example} for a complete implementation.
+
\sa QQuickImageProvider
*/
@@ -472,6 +474,8 @@ QQuickTextureFactory *QQuickImageProvider::requestTexture(const QString &id, QSi
\inmodule QtQuick
\brief The QQuickAsyncImageProvider class provides an interface for for asynchronous control of QML image requests.
+ See the \l {imageresponseprovider}{Image Response Provider Example} for a complete implementation.
+
\sa QQuickImageProvider
*/
QQuickAsyncImageProvider::QQuickAsyncImageProvider()