diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-05-20 03:55:59 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-05-20 04:27:26 (GMT) |
commit | 09c2a8fea97c1e4e9882dcfe788139268de05ef3 (patch) | |
tree | 4c8f6e2bb0a4777deb3ef1a4eacb436b316de3ac /src | |
parent | 695461282f1e225608800f87cf1259176067e55d (diff) | |
download | Qt-09c2a8fea97c1e4e9882dcfe788139268de05ef3.zip Qt-09c2a8fea97c1e4e9882dcfe788139268de05ef3.tar.gz Qt-09c2a8fea97c1e4e9882dcfe788139268de05ef3.tar.bz2 |
Simplify code to make next change clearer.
Diffstat (limited to 'src')
-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 { |