aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlengine.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@qt.io>2017-05-03 15:27:52 +0200
committerFrederik Gladhorn <frederik.gladhorn@qt.io>2017-05-04 10:19:39 +0000
commit4be38abab97f07b999ca3b2da3c45c5423d83dc0 (patch)
tree41c23500fec45ee37b879fd3f734a7538278bc98 /src/qml/qml/qqmlengine.cpp
parentd27047bd90e5863675ed2da4f47e88295bac7100 (diff)
Allow creating attached properties for objects instantiated in C++
Task-number: QTBUG-57396 Change-Id: I31912677ebfdcea9ba97fe0bb66d56bb82b4c90c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r--src/qml/qml/qqmlengine.cpp4
1 files changed, 2 insertions, 2 deletions
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)