diff options
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 68e2c2c928..d015a2c0e8 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -381,6 +381,16 @@ void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const } } + if (property->isQObject()) { + if (binding->type == QV4::CompiledData::Binding::Type_Null) { + QObject *value = nullptr; + const bool ok = property->writeProperty(_qobject, &value, propertyWriteFlags); + Q_ASSERT(ok); + Q_UNUSED(ok); + return; + } + } + switch (propertyType) { case QMetaType::QVariant: { if (binding->type == QV4::CompiledData::Binding::Type_Number) { @@ -408,6 +418,13 @@ void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const QVariant value(binding->valueAsBoolean()); property->writeProperty(_qobject, &value, propertyWriteFlags); } + } else if (binding->type == QV4::CompiledData::Binding::Type_Null) { + if (property->isVarProperty()) { + _vmeMetaObject->setVMEProperty(property->coreIndex(), QV4::Value::nullValue()); + } else { + QVariant nullValue = QVariant::fromValue(nullptr); + property->writeProperty(_qobject, &nullValue, propertyWriteFlags); + } } else { QString stringValue = binding->valueAsString(compilationUnit.data()); if (property->isVarProperty()) { @@ -663,6 +680,8 @@ void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const value = QJSValue(int(n)); } else value = QJSValue(n); + } else if (binding->type == QV4::CompiledData::Binding::Type_Null) { + value = QJSValue::NullValue; } else { value = QJSValue(binding->valueAsString(compilationUnit.data())); } |