diff options
Diffstat (limited to 'src/declarative/qml/qmlcomponent.cpp')
-rw-r--r-- | src/declarative/qml/qmlcomponent.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index e897cce..f291ac0 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -121,6 +121,14 @@ void QmlComponentPrivate::typeDataReady() emit q->statusChanged(q->status()); } +void QmlComponentPrivate::updateProgress(qreal p) +{ + Q_Q(QmlComponent); + + progress = p; + emit q->progressChanged(p); +} + void QmlComponentPrivate::fromTypeData(QmlCompositeTypeData *data) { url = data->imports.baseUrl(); @@ -238,6 +246,12 @@ bool QmlComponent::isLoading() const return status() == Loading; } +qreal QmlComponent::progress() const +{ + Q_D(const QmlComponent); + return d->progress; +} + /*! \fn void QmlComponent::statusChanged(QmlComponent::Status status) @@ -343,7 +357,9 @@ void QmlComponent::setData(const QByteArray &data, const QUrl &url) } + d->progress = 1.0; emit statusChanged(status()); + emit progressChanged(d->progress); } /*! @@ -364,17 +380,16 @@ void QmlComponent::loadUrl(const QUrl &url) QmlEnginePrivate::get(d->engine)->typeManager.get(d->url); if (data->status == QmlCompositeTypeData::Waiting) { - d->typeData = data; d->typeData->addWaiter(d); - + d->progress = data->progress; } else { - d->fromTypeData(data); - + d->progress = 1.0; } emit statusChanged(status()); + emit progressChanged(d->progress); } /*! |