summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcomponent.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-09-07 06:19:33 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-09-07 06:19:33 (GMT)
commitcdc50db23a89721f793ef353fb4d64b0631456c0 (patch)
tree06f017b87a3052ddb32359b14b6ae94ca070183d /src/declarative/qml/qmlcomponent.cpp
parenteb1890d43f2abbac594f17eea047e88c3c0b529e (diff)
downloadQt-cdc50db23a89721f793ef353fb4d64b0631456c0.zip
Qt-cdc50db23a89721f793ef353fb4d64b0631456c0.tar.gz
Qt-cdc50db23a89721f793ef353fb4d64b0631456c0.tar.bz2
Add status and progress properties to Loader.
Diffstat (limited to 'src/declarative/qml/qmlcomponent.cpp')
-rw-r--r--src/declarative/qml/qmlcomponent.cpp23
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);
}
/*!