summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/qmlengine.cpp')
-rw-r--r--src/declarative/qml/qmlengine.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 6756642..558bd49 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -191,7 +191,10 @@ QmlEnginePrivate::queryObject(const QString &propName,
{
QScriptClass::QueryFlags rv = 0;
- QmlMetaProperty prop(obj, propName, rootContext);
+ QmlContext *ctxt = QmlEngine::contextForObject(obj);
+ if (!ctxt)
+ ctxt = rootContext;
+ QmlMetaProperty prop(obj, propName, ctxt);
if (prop.type() == QmlMetaProperty::Invalid) {
QPair<const QMetaObject *, QString> key =
qMakePair(obj->metaObject(), propName);