diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-20 04:49:36 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-20 04:49:36 (GMT) |
commit | 78c78085449149b5c48bbecd49424974cdf79bee (patch) | |
tree | c56b323d7270bb3515d2d7277e366a8fa2e76e34 /src/declarative/qml/qdeclarativeobjectscriptclass.cpp | |
parent | 27b09c283d68fa4b1eae32f82a1041bca1a28656 (diff) | |
download | Qt-78c78085449149b5c48bbecd49424974cdf79bee.zip Qt-78c78085449149b5c48bbecd49424974cdf79bee.tar.gz Qt-78c78085449149b5c48bbecd49424974cdf79bee.tar.bz2 |
Allow null to be assigned to object properties
Diffstat (limited to 'src/declarative/qml/qdeclarativeobjectscriptclass.cpp')
-rw-r--r-- | src/declarative/qml/qdeclarativeobjectscriptclass.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index a194354..bb5c8b7 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -353,7 +353,13 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj, if (delBinding) delBinding->destroy(); - if (value.isUndefined() && lastData->flags & QDeclarativePropertyCache::Data::IsResettable) { + if (value.isNull() && lastData->flags & QDeclarativePropertyCache::Data::IsQObjectDerived) { + QObject *o = 0; + int status = -1; + int flags = 0; + void *argv[] = { &o, 0, &status, &flags }; + QMetaObject::metacall(obj, QMetaObject::WriteProperty, lastData->coreIndex, argv); + } else if (value.isUndefined() && lastData->flags & QDeclarativePropertyCache::Data::IsResettable) { void *a[] = { 0 }; QMetaObject::metacall(obj, QMetaObject::ResetProperty, lastData->coreIndex, a); } else if (value.isUndefined() && lastData->propType == qMetaTypeId<QVariant>()) { |