diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-05-20 04:15:48 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-05-20 04:27:26 (GMT) |
commit | e75088323ae15604139ddfd66b85cc3b8d43abeb (patch) | |
tree | ae7fd462b5255a0ed8cef079716f64749bc02e9c /src | |
parent | 09c2a8fea97c1e4e9882dcfe788139268de05ef3 (diff) | |
download | Qt-e75088323ae15604139ddfd66b85cc3b8d43abeb.zip Qt-e75088323ae15604139ddfd66b85cc3b8d43abeb.tar.gz Qt-e75088323ae15604139ddfd66b85cc3b8d43abeb.tar.bz2 |
Be consistent in conversion from string (eg. color, int rounding).
Task-number: QTBUG-10820
Reviewed-by: Michael Brasser
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/qml/qdeclarativeproperty.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index 723237a..071dd07 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -1050,18 +1050,21 @@ bool QDeclarativePropertyPrivate::write(QObject *object, const QDeclarativePrope Q_ASSERT(variantType != propertyType); bool ok = false; - QVariant v = value; - if (v.convert((QVariant::Type)propertyType)) { - ok = true; - } else if ((uint)propertyType >= QVariant::UserType && variantType == QVariant::String) { - QDeclarativeMetaType::StringConverter con = QDeclarativeMetaType::customStringConverter(propertyType); - if (con) { - v = con(value.toString()); - if (v.userType() == propertyType) - ok = true; - } - } else if (variantType == QVariant::String) { + QVariant v; + if (variantType == QVariant::String) v = QDeclarativeStringConverters::variantFromString(value.toString(), propertyType, &ok); + if (!ok) { + v = value; + if (v.convert((QVariant::Type)propertyType)) { + ok = true; + } else if ((uint)propertyType >= QVariant::UserType && variantType == QVariant::String) { + QDeclarativeMetaType::StringConverter con = QDeclarativeMetaType::customStringConverter(propertyType); + if (con) { + v = con(value.toString()); + if (v.userType() == propertyType) + ok = true; + } + } } if (ok) { void *a[] = { (void *)v.constData(), 0, &status, &flags}; |