aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickloader.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2012-03-06 18:03:33 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-15 10:14:37 +0100
commit31467e8649979d06ea2f676768016e6a147eadb9 (patch)
treeb318865886c33aa266141870972adc03900522e0 /src/quick/items/qquickloader.cpp
parentb634c19680cd1d4dd925a18e616844ed420d18ae (diff)
Allow threaded compilation in an async Loader
Enables threaded compilation for a Loader "source". Change-Id: I2d60a3ace07aab58f3b8f069e45a2864178c959f Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'src/quick/items/qquickloader.cpp')
-rw-r--r--src/quick/items/qquickloader.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index 8877385b46..59cb37c15d 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -344,7 +344,8 @@ void QQuickLoader::loadFromSource()
}
if (isComponentComplete()) {
- d->component = new QQmlComponent(qmlEngine(this), d->source, this);
+ QQmlComponent::CompilationMode mode = d->asynchronous ? QQmlComponent::Asynchronous : QQmlComponent::PreferSynchronous;
+ d->component = new QQmlComponent(qmlEngine(this), d->source, mode, this);
d->load();
}
}
@@ -711,7 +712,8 @@ void QQuickLoader::componentComplete()
QQuickItem::componentComplete();
if (active()) {
if (d->loadingFromSource) {
- d->component = new QQmlComponent(qmlEngine(this), d->source, this);
+ QQmlComponent::CompilationMode mode = d->asynchronous ? QQmlComponent::Asynchronous : QQmlComponent::PreferSynchronous;
+ d->component = new QQmlComponent(qmlEngine(this), d->source, mode, this);
}
d->load();
}
@@ -752,6 +754,9 @@ qreal QQuickLoader::progress() const
This property holds whether the component will be instantiated asynchronously.
+When used in conjunction with the \l source property, loading and compilation
+will also be performed in a background thread.
+
Loading asynchronously creates the objects declared by the component
across multiple frames, and reduces the
likelihood of glitches in animation. When loading asynchronously the status