From 4be38abab97f07b999ca3b2da3c45c5423d83dc0 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 3 May 2017 15:27:52 +0200 Subject: Allow creating attached properties for objects instantiated in C++ Task-number: QTBUG-57396 Change-Id: I31912677ebfdcea9ba97fe0bb66d56bb82b4c90c Reviewed-by: Simon Hausmann --- src/qml/qml/qqmlengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/qml/qml') diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 74b03c9f72..4a21acb050 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -1492,9 +1492,9 @@ QQmlEngine *qmlEngine(const QObject *obj) QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool create) { - QQmlData *data = QQmlData::get(object); + QQmlData *data = QQmlData::get(object, create); if (!data) - return 0; // Attached properties are only on objects created by QML + return 0; // Attached properties are only on objects created by QML, unless explicitly requested (create==true) QObject *rv = data->hasExtendedData()?data->attachedProperties()->value(id):0; if (rv || !create) -- cgit v1.2.3