diff options
-rw-r--r-- | src/declarative/qml/qdeclarativeproperty.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index 3881d0a..723237a 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -1049,26 +1049,21 @@ bool QDeclarativePropertyPrivate::write(QObject *object, const QDeclarativePrope } else { Q_ASSERT(variantType != propertyType); + bool ok = false; QVariant v = value; if (v.convert((QVariant::Type)propertyType)) { - void *a[] = { (void *)v.constData(), 0, &status, &flags}; - QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); + ok = true; } else if ((uint)propertyType >= QVariant::UserType && variantType == QVariant::String) { QDeclarativeMetaType::StringConverter con = QDeclarativeMetaType::customStringConverter(propertyType); - if (!con) - return false; - - QVariant v = con(value.toString()); - if (v.userType() == propertyType) { - void *a[] = { (void *)v.constData(), 0, &status, &flags}; - QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); + if (con) { + v = con(value.toString()); + if (v.userType() == propertyType) + ok = true; } } else if (variantType == QVariant::String) { - bool ok = false; - QVariant v = QDeclarativeStringConverters::variantFromString(value.toString(), propertyType, &ok); - if (!ok) - return false; - + v = QDeclarativeStringConverters::variantFromString(value.toString(), propertyType, &ok); + } + if (ok) { void *a[] = { (void *)v.constData(), 0, &status, &flags}; QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); } else { |