summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcomponent.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-10-28 06:09:38 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-10-28 06:09:38 (GMT)
commit1e9661995a5c12d41da31d001c6ded30d0ae1b29 (patch)
tree7581c79dfdc125237e0bc63bd267fc2b396b3404 /src/declarative/qml/qmlcomponent.cpp
parentcbc205d5b1fada56e2de82fa7c971ac7cefdf3fe (diff)
parentb7a30841120afb7be26fe980489db5757f1d2ef3 (diff)
downloadQt-1e9661995a5c12d41da31d001c6ded30d0ae1b29.zip
Qt-1e9661995a5c12d41da31d001c6ded30d0ae1b29.tar.gz
Qt-1e9661995a5c12d41da31d001c6ded30d0ae1b29.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/qml/qmlcomponent.cpp')
-rw-r--r--src/declarative/qml/qmlcomponent.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp
index 02c9b10..6181f41 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qmlcomponent.cpp
@@ -55,6 +55,7 @@
#include "qmlbinding.h"
#include <QtCore/qdebug.h>
#include <QApplication>
+#include <private/qmlbinding_p.h>
#include "qmlscriptparser_p.h"
@@ -74,7 +75,7 @@ int statusId = qRegisterMetaType<QmlComponent::Status>("QmlComponent::Status");
\brief The Component element encapsulates a QML component description.
Components are reusable, encapsulated Qml element with a well-defined interface.
- They are often defined in \l {components}{Component Files}.
+ They are often defined in \l {qmldocuments.html}{Component Files}.
The \e Component element allows defining components within a QML file.
This can be useful for reusing a small component within a single QML
@@ -197,6 +198,12 @@ QmlComponent::QmlComponent(QObject *parent)
QmlComponent::~QmlComponent()
{
Q_D(QmlComponent);
+
+ if (d->completePending) {
+ qWarning("QmlComponent: Component destroyed while completion pending");
+ d->completeCreate();
+ }
+
if (d->typeData) {
d->typeData->remWaiter(d);
d->typeData->release();
@@ -267,6 +274,10 @@ bool QmlComponent::isLoading() const
return status() == Loading;
}
+/*!
+ Returns he progress of loading the component, from 0.0 (nothing loaded)
+ to 1.0 (finished).
+*/
qreal QmlComponent::progress() const
{
Q_D(const QmlComponent);
@@ -274,6 +285,13 @@ qreal QmlComponent::progress() const
}
/*!
+ \fn void QmlComponent::progressChanged(qreal progress)
+
+ Emitted whenever the component's loading progress changes. \a progress will be the
+ current progress between 0.0 (nothing loaded) and 1.0 (finished).
+*/
+
+/*!
\fn void QmlComponent::statusChanged(QmlComponent::Status status)
Emitted whenever the component's status changes. \a status will be the
@@ -577,8 +595,10 @@ QmlComponentPrivate::beginCreate(QmlContext *context, const QBitField &bindings)
ep->bindValues.clear();
ep->parserStatus.clear();
completePending = true;
+ QmlEnginePrivate::get(engine)->inProgressCreations++;
}
+
if (rv) {
QFx_setParent_noEvent(ctxt, rv);
} else {
@@ -646,6 +666,14 @@ void QmlComponentPrivate::completeCreate()
bindValues.clear();
parserStatus.clear();
completePending = false;
+ QmlEnginePrivate *p = QmlEnginePrivate::get(engine);
+ p->inProgressCreations--;
+ if (0 == p->inProgressCreations) {
+ while (p->erroredBindings) {
+ qWarning().nospace() << qPrintable(p->erroredBindings->error.toString());
+ p->erroredBindings->removeError();
+ }
+ }
}
}
@@ -662,6 +690,9 @@ QmlComponentAttached::~QmlComponentAttached()
next = 0;
}
+/*!
+ \internal
+*/
QmlComponentAttached *QmlComponent::qmlAttachedProperties(QObject *obj)
{
QmlComponentAttached *a = new QmlComponentAttached(obj);