aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlengine.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-10-14 15:48:12 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-10-14 15:48:12 +0200
commit7063fefe4b5e866b27001bb9b911fc2f68034e40 (patch)
tree1ce35139475d83399572a3265414c2da3443a321 /src/qml/qml/qqmlengine.cpp
parentf3446071da8357620d0c8593a04e3b4fbba88f21 (diff)
parent4f3379352a265bab00a7265f85ffc38a9ca4ffe4 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r--src/qml/qml/qqmlengine.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 47cd36b8f6..56252ec1ab 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -913,7 +913,7 @@ QQuickWorkerScriptEngine *QQmlEnginePrivate::getWorkerScriptEngine()
Note that the \l {Qt Quick 1} version is called QDeclarativeEngine.
- \sa QQmlComponent, QQmlContext
+ \sa QQmlComponent, QQmlContext, {QML Global Object}
*/
/*!
@@ -1435,7 +1435,8 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool cre
if (rv || !create)
return rv;
- QQmlAttachedPropertiesFunc pf = QQmlMetaType::attachedPropertiesFuncById(id);
+ QQmlEnginePrivate *engine = QQmlEnginePrivate::get(data->context);
+ QQmlAttachedPropertiesFunc pf = QQmlMetaType::attachedPropertiesFuncById(engine, id);
if (!pf)
return 0;
@@ -1450,8 +1451,10 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool cre
QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
const QMetaObject *attachedMetaObject, bool create)
{
- if (*idCache == -1)
- *idCache = QQmlMetaType::attachedPropertiesFuncId(attachedMetaObject);
+ if (*idCache == -1) {
+ QQmlEngine *engine = object ? qmlEngine(object) : 0;
+ *idCache = QQmlMetaType::attachedPropertiesFuncId(engine ? QQmlEnginePrivate::get(engine) : 0, attachedMetaObject);
+ }
if (*idCache == -1 || !object)
return 0;