diff options
author | Oleg Shparber <trollixx@gmail.com> | 2014-06-24 17:03:08 -0700 |
---|---|---|
committer | Oleg Shparber <trollixx@gmail.com> | 2014-06-25 17:31:47 +0200 |
commit | 435fb273355566c2888f8f685a369ce689869a14 (patch) | |
tree | 30ab03d005681f9a7666d5e76ad98bb419905263 /src | |
parent | 57e3ef14fdcf6ae337075b68d374827b12397a7d (diff) |
Allow integer values to be assigned QList<qreal> properties
Before this patch it was not possible to assign an integer value to
QList<qreal> property, while it worked for non-list properties.
Change-Id: Iab00288f7d78f4f76056ab4291700d7f51626de4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/compiler/qqmltypecompiler.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlproperty.cpp | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp index e1f68a6dac..e2636a57c3 100644 --- a/src/qml/compiler/qqmltypecompiler.cpp +++ b/src/qml/compiler/qqmltypecompiler.cpp @@ -2244,7 +2244,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa // generate single literal value assignment to a list property if required if (property->propType == qMetaTypeId<QList<qreal> >()) { if (binding->type != QV4::CompiledData::Binding::Type_Number) { - recordError(binding->valueLocation, tr("Invalid property assignment: real or array of reals expected")); + recordError(binding->valueLocation, tr("Invalid property assignment: number or array of numbers expected")); return false; } break; diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index 1075b53c5e..c9d5f76fbd 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -1427,7 +1427,8 @@ bool QQmlPropertyPrivate::write(QObject *object, list << value.toInt(); v = QVariant::fromValue<QList<int> >(list); ok = true; - } else if (variantType == QVariant::Double && propertyType == qMetaTypeId<QList<qreal> >()) { + } else if ((variantType == QVariant::Double || variantType == QVariant::Int) + && (propertyType == qMetaTypeId<QList<qreal> >())) { QList<qreal> list; list << value.toReal(); v = QVariant::fromValue<QList<qreal> >(list); |