diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-05-25 04:47:02 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-05-25 04:47:02 (GMT) |
commit | d982ded10a3dd5219ae40a5a3574b63ac7bdda3f (patch) | |
tree | 9e1b0ef8d2ce2f913cf0f7049dcfef9a53c1525c /src | |
parent | 2b3e7706f4459569520c77b9fb3ff2bc006e60f1 (diff) | |
download | Qt-d982ded10a3dd5219ae40a5a3574b63ac7bdda3f.zip Qt-d982ded10a3dd5219ae40a5a3574b63ac7bdda3f.tar.gz Qt-d982ded10a3dd5219ae40a5a3574b63ac7bdda3f.tar.bz2 |
Always pass context to QObject script class
QTBUG-10659
Diffstat (limited to 'src')
4 files changed, 9 insertions, 6 deletions
diff --git a/src/declarative/qml/qdeclarativecontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp index 1ebedbb..03a1f6a 100644 --- a/src/declarative/qml/qdeclarativecontextscriptclass.cpp +++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp @@ -270,7 +270,7 @@ QDeclarativeContextScriptClass::property(Object *object, const Identifier &name) if (lastScopeObject) { - return ep->objectClass->property(lastScopeObject, name); + return ep->objectClass->property(lastScopeObject, name, context()); } else if (lastData) { diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index be2be8b..7c818a6 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -203,12 +203,14 @@ QDeclarativeObjectScriptClass::queryProperty(QObject *obj, const Identifier &nam QDeclarativeObjectScriptClass::Value QDeclarativeObjectScriptClass::property(Object *object, const Identifier &name) { - return property(toQObject(object), name); + return property(toQObject(object), name, context()); } QDeclarativeObjectScriptClass::Value -QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name) +QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name, QScriptContext *context) { + Q_ASSERT(context); + QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); if (name == m_destroyId.identifier) @@ -220,7 +222,7 @@ QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name) if (lastData && !lastData->isValid()) { QString error = QLatin1String("Cannot access non-existent property \"") + toString(name) + QLatin1Char('\"'); - return Value(scriptEngine, context()->throwError(error)); + return Value(scriptEngine, context->throwError(error)); } Q_ASSERT(obj); diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h index 34c71a0..61fa586 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h +++ b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h @@ -113,10 +113,11 @@ public: QDeclarativeContextData *evalContext, QueryHints hints = 0); - Value property(QObject *, const Identifier &); + Value property(QObject *, const Identifier &, QScriptContext *context); void setProperty(QObject *, const Identifier &name, const QScriptValue &, QScriptContext *context, QDeclarativeContextData *evalContext = 0); + virtual QStringList propertyNames(Object *); virtual bool compare(Object *, Object *); diff --git a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp index 2a3417a..b512387 100644 --- a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp +++ b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp @@ -147,7 +147,7 @@ QDeclarativeTypeNameScriptClass::property(Object *obj, const Identifier &name) if (type) { return Value(scriptEngine, newObject(((TypeNameData *)obj)->object, type, ((TypeNameData *)obj)->mode)); } else if (object) { - return ep->objectClass->property(object, name); + return ep->objectClass->property(object, name, context()); } else { return Value(scriptEngine, enumValue); } |