summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-06 08:32:25 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-06 08:32:25 (GMT)
commitd641b621077d5cc81ce7b3de92af9a0f6d47f4d6 (patch)
treea6d367c55d3d2ec41cf8bf92a439c8cc14c717d8 /src/declarative
parent6c7b88af807cbd2b4d824b8fca0f199ae1413432 (diff)
downloadQt-d641b621077d5cc81ce7b3de92af9a0f6d47f4d6.zip
Qt-d641b621077d5cc81ce7b3de92af9a0f6d47f4d6.tar.gz
Qt-d641b621077d5cc81ce7b3de92af9a0f6d47f4d6.tar.bz2
Doc
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/qml/qml.h6
-rw-r--r--src/declarative/qml/qmlengine.cpp4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/declarative/qml/qml.h b/src/declarative/qml/qml.h
index 1990b7f..cd01f6a 100644
--- a/src/declarative/qml/qml.h
+++ b/src/declarative/qml/qml.h
@@ -93,10 +93,10 @@ class QmlEngine;
Q_DECLARATIVE_EXPORT void qmlExecuteDeferred(QObject *);
Q_DECLARATIVE_EXPORT QmlContext *qmlContext(const QObject *);
Q_DECLARATIVE_EXPORT QmlEngine *qmlEngine(const QObject *);
-Q_DECLARATIVE_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *);
+Q_DECLARATIVE_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *, bool create = true);
template<typename T>
-QObject *qmlAttachedPropertiesObject(const QObject *obj)
+QObject *qmlAttachedPropertiesObject(const QObject *obj, bool create = true)
{
// ### is this threadsafe?
static int idx = -1;
@@ -107,7 +107,7 @@ QObject *qmlAttachedPropertiesObject(const QObject *obj)
if (idx == -1 || !obj)
return 0;
- return qmlAttachedPropertiesObjectById(idx, obj);
+ return qmlAttachedPropertiesObjectById(idx, obj, create);
}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 9eb169e..01a0494 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -707,13 +707,13 @@ QmlEngine *qmlEngine(const QObject *obj)
return context?context->engine():0;
}
-QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object)
+QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool create)
{
QmlExtendedDeclarativeData *edata =
QmlExtendedDeclarativeData::get(const_cast<QObject *>(object), true);
QObject *rv = edata->attachedProperties.value(id);
- if (rv)
+ if (rv || !create)
return rv;
QmlAttachedPropertiesFunc pf = QmlMetaType::attachedPropertiesFuncById(id);