summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp17
-rw-r--r--src/declarative/qml/qdeclarativecomponent_p.h1
-rw-r--r--src/declarative/qml/qdeclarativecontextscriptclass.cpp16
3 files changed, 26 insertions, 8 deletions
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 276f790..8238252 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -880,6 +880,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon
state->bindValues = enginePriv->bindValues;
state->parserStatus = enginePriv->parserStatus;
+ state->finalizedParserStatus = enginePriv->finalizedParserStatus;
state->componentAttached = enginePriv->componentAttached;
if (state->componentAttached)
state->componentAttached->prev = &state->componentAttached;
@@ -887,6 +888,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon
enginePriv->componentAttached = 0;
enginePriv->bindValues.clear();
enginePriv->parserStatus.clear();
+ enginePriv->finalizedParserStatus.clear();
state->completePending = true;
enginePriv->inProgressCreations++;
}
@@ -917,6 +919,7 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi
state->bindValues = enginePriv->bindValues;
state->parserStatus = enginePriv->parserStatus;
+ state->finalizedParserStatus = enginePriv->finalizedParserStatus;
state->componentAttached = enginePriv->componentAttached;
if (state->componentAttached)
state->componentAttached->prev = &state->componentAttached;
@@ -924,6 +927,7 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi
enginePriv->componentAttached = 0;
enginePriv->bindValues.clear();
enginePriv->parserStatus.clear();
+ enginePriv->finalizedParserStatus.clear();
state->completePending = true;
enginePriv->inProgressCreations++;
}
@@ -961,6 +965,18 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri
QDeclarativeEnginePrivate::clear(ps);
}
+ for (int ii = 0; ii < state->finalizedParserStatus.count(); ++ii) {
+ QPair<QDeclarativeGuard<QObject>, int> status = state->finalizedParserStatus.at(ii);
+ QObject *obj = status.first;
+ if (obj) {
+ void *args[] = { 0 };
+ QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod,
+ status.second, args);
+ }
+ }
+
+ //componentComplete() can register additional finalization objects
+ //that are then never handled. Handle them manually here.
if (1 == enginePriv->inProgressCreations) {
for (int ii = 0; ii < enginePriv->finalizedParserStatus.count(); ++ii) {
QPair<QDeclarativeGuard<QObject>, int> status = enginePriv->finalizedParserStatus.at(ii);
@@ -986,6 +1002,7 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri
state->bindValues.clear();
state->parserStatus.clear();
+ state->finalizedParserStatus.clear();
state->completePending = false;
enginePriv->inProgressCreations--;
diff --git a/src/declarative/qml/qdeclarativecomponent_p.h b/src/declarative/qml/qdeclarativecomponent_p.h
index 020c5e0..f8bec2b 100644
--- a/src/declarative/qml/qdeclarativecomponent_p.h
+++ b/src/declarative/qml/qdeclarativecomponent_p.h
@@ -101,6 +101,7 @@ public:
ConstructionState() : componentAttached(0), completePending(false) {}
QList<QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> > bindValues;
QList<QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> > parserStatus;
+ QList<QPair<QDeclarativeGuard<QObject>, int> > finalizedParserStatus;
QDeclarativeComponentAttached *componentAttached;
QList<QDeclarativeError> errors;
bool completePending;
diff --git a/src/declarative/qml/qdeclarativecontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
index bb4ece4..3abd787 100644
--- a/src/declarative/qml/qdeclarativecontextscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
@@ -227,6 +227,7 @@ QDeclarativeContextScriptClass::queryProperty(QDeclarativeContextData *bindConte
if (data) {
lastData = data;
lastContext = bindContext;
+ lastScopeObject = scopeObject;
return QScriptClass::HandlesReadAccess;
}
}
@@ -268,17 +269,12 @@ QDeclarativeContextScriptClass::property(Object *object, const Identifier &name)
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
- if (lastScopeObject) {
-
- return ep->objectClass->property(lastScopeObject, name);
-
- } else if (lastData) {
+ if (lastData) {
if (lastData->type) {
- return Value(scriptEngine, ep->typeNameClass->newObject(bindContext->contextObject, lastData->type));
+ return Value(scriptEngine, ep->typeNameClass->newObject(lastScopeObject, lastData->type));
} else if (lastData->typeNamespace) {
- return Value(scriptEngine, ep->typeNameClass->newObject(bindContext->contextObject,
- lastData->typeNamespace));
+ return Value(scriptEngine, ep->typeNameClass->newObject(lastScopeObject, lastData->typeNamespace));
} else {
int index = lastData->importedScriptIndex;
if (index < bindContext->importedScripts.count()) {
@@ -288,6 +284,10 @@ QDeclarativeContextScriptClass::property(Object *object, const Identifier &name)
}
}
+ } else if (lastScopeObject) {
+
+ return ep->objectClass->property(lastScopeObject, name);
+
} else if (lastPropertyIndex != -1) {
QScriptValue rv;