aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@nokia.com>2012-05-08 10:28:24 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-11 15:12:15 +0200
commit125f4ceb393886015574a3c3fd0fc264a4f2deb6 (patch)
treec552a05bd3030dd8c3d9a2c307e9dca0a1b9e7e9 /src/qml/qml
parent9b224d33216b0e21292b44743aa4594665ebf970 (diff)
Allow image providers to force their loading to be asynchronous
The request methods of an image provider are assumed to be synchronous, but sometimes the provider will be implemented in an async manner, eg. through network request or doing the I/O on a different thread. In that case, the provider can't expose this async behavior to clients, but needs to block in the request method. This is less then ideal for clients, since the default behvior of an image element is to load synchronously, so we introduce a new flag to image providers that let's the provider force the loading to happen on the async image loading thread. Similar to network requests (which are always async), this does not affect the 'asynchronous' property of the image element. Change-Id: I9542abbcc594b9aab565210bc3005a95592c1e9c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@nokia.com> Reviewed-by: Michalina Ziemba <michalina.ziemba@nokia.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r--src/qml/qml/qqmlengine.cpp10
-rw-r--r--src/qml/qml/qqmlengine.h7
2 files changed, 17 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 13344f0710..b6a306085e 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -204,6 +204,16 @@ void QQmlEnginePrivate::defineModule()
The QQuickImageProvider::requestTexture() method will be called for all image requests. \omitvalue
*/
+/*!
+ \enum QQmlImageProviderBase::Flag
+
+ Defines specific requirements or features of this image provider.
+
+ \value ForceAsynchronousImageLoading Ensures that image requests to the provider are
+ run in a separate thread, which allows the provider to spend as much time as needed
+ on producing the image without blocking the main thread.
+*/
+
/*! \internal */
QQmlImageProviderBase::QQmlImageProviderBase()
{
diff --git a/src/qml/qml/qqmlengine.h b/src/qml/qml/qqmlengine.h
index 8d250ed209..8640f1acad 100644
--- a/src/qml/qml/qqmlengine.h
+++ b/src/qml/qml/qqmlengine.h
@@ -64,14 +64,21 @@ public:
Invalid
};
+ enum Flag {
+ ForceAsynchronousImageLoading = 0x01
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
virtual ~QQmlImageProviderBase();
virtual ImageType imageType() const = 0;
+ virtual Flags flags() const = 0;
private:
friend class QQuickImageProvider;
QQmlImageProviderBase();
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlImageProviderBase::Flags)
class QQmlComponent;
class QQmlEnginePrivate;