diff options
Diffstat (limited to 'src/quick/items/qquickloader.cpp')
-rw-r--r-- | src/quick/items/qquickloader.cpp | 9 |
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 |