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/qdeclarativebinding.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/qdeclarativebinding.cpp')
-rw-r--r-- | src/declarative/qml/qdeclarativebinding.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index d759427..95520da 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -156,6 +156,9 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) QScriptValue scriptValue = d->scriptValue(0, &isUndefined); if (data->property.propertyTypeCategory() == QDeclarativeProperty::List) { value = ep->scriptValueToVariant(scriptValue, qMetaTypeId<QList<QObject *> >()); + } else if (scriptValue.isNull() && + data->property.propertyTypeCategory() == QDeclarativeProperty::Object) { + value = QVariant::fromValue((QObject *)0); } else { value = ep->scriptValueToVariant(scriptValue, data->property.propertyType()); if (value.userType() == QMetaType::QObjectStar && !qvariant_cast<QObject*>(value)) { @@ -168,6 +171,7 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) } } + if (data->error.isValid()) { } else if (isUndefined && data->property.isResettable()) { |