Add support for assigning literal value to sequence property
authorChris Adams <christopher.adams@nokia.com>
Wed, 2 Nov 2011 00:21:37 +0000 (10:21 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 1 Dec 2011 01:40:06 +0000 (02:40 +0100)
commitfdbdbbdd4ff05d1ceb7667227db5b14687a77c96
tree6f738ccc1d784a8dc18bff15cdbcb8e6973c48e8
parentf304dd6fbb9d901c0a72609dc3c384eab4935f93
Add support for assigning literal value to sequence property

It is a language semantic that we allow clients to assign a single
value to a sequence/list property (assuming that the types match).
Now that we support sequence types, this commit adds support for
this semantic by determining whether the built-in type of the literal
corresponds to the associated sequence (eg, int for QList<int>, qreal
for QList<qreal>, bool for QList<bool>, QString for QStringList etc).

Similarly, some value types can be constructed from literal string
values (via string converters) and these need to be handled also.

Task-number: QTBUG-18062
Task-number: QTBUG-21770
Change-Id: Iacd91b2af122cd8f20b7df2fa6056a7d7c52bf53
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
12 files changed:
src/declarative/qml/qdeclarativecompiler.cpp
src/declarative/qml/qdeclarativeinstruction.cpp
src/declarative/qml/qdeclarativeinstruction_p.h
src/declarative/qml/qdeclarativeproperty.cpp
src/declarative/qml/qdeclarativevme.cpp
tests/auto/declarative/qdeclarativeecmascript/data/assignSequenceTypes.1.qml [new file with mode: 0644]
tests/auto/declarative/qdeclarativeecmascript/data/assignSequenceTypes.2.qml [new file with mode: 0644]
tests/auto/declarative/qdeclarativeecmascript/data/assignSequenceTypes.3.qml [new file with mode: 0644]
tests/auto/declarative/qdeclarativeecmascript/data/assignSequenceTypes.4.qml [new file with mode: 0644]
tests/auto/declarative/qdeclarativeecmascript/data/assignSequenceTypes.5.qml [new file with mode: 0644]
tests/auto/declarative/qdeclarativeecmascript/data/assignSequenceTypes.6.qml [new file with mode: 0644]
tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp