prop.clear(&prop);
- if (value.userType() == qMetaTypeId<QList<QObject *> >()) {
+ if (value.userType() == qMetaTypeId<QDeclarativeListReference>()) {
+ QDeclarativeListReference qdlr = value.value<QDeclarativeListReference>();
+
+ for (int ii = 0; ii < qdlr.count(); ++ii) {
+ QObject *o = qdlr.at(ii);
+ if (o && !canConvert(o->metaObject(), listType))
+ o = 0;
+ prop.append(&prop, (void *)o);
+ }
+ } else if (value.userType() == qMetaTypeId<QList<QObject *> >()) {
const QList<QObject *> &list = qvariant_cast<QList<QObject *> >(value);
for (int ii = 0; ii < list.count(); ++ii) {
--- /dev/null
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+ width: 640
+ height: 480
+
+ property int list1length: list1.length
+
+ property list<MyQmlObject> list1
+ property list<MyQmlObject> list2: [
+ MyQmlObject { id: one; value: 100 },
+ MyQmlObject { id: two; value: 300 }
+ ]
+
+ Component.onCompleted: {
+ root.list1 = root.list2;
+ }
+}
void jsObject();
void undefinedResetsProperty();
void listToVariant();
+ void listAssignment();
void multiEngineObject();
void deletedObject();
void attachedPropertyScope();
delete object;
}
+// QTBUG-16316
+Q_DECLARE_METATYPE(QDeclarativeListProperty<MyQmlObject>)
+void tst_qdeclarativeecmascript::listAssignment()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("listAssignment.qml"));
+ QObject *obj = component.create();
+ QCOMPARE(obj->property("list1length").toInt(), 2);
+ QDeclarativeListProperty<MyQmlObject> list1 = obj->property("list1").value<QDeclarativeListProperty<MyQmlObject> >();
+ QDeclarativeListProperty<MyQmlObject> list2 = obj->property("list2").value<QDeclarativeListProperty<MyQmlObject> >();
+ QCOMPARE(list1.count(&list1), list2.count(&list2));
+ QCOMPARE(list1.at(&list1, 0), list2.at(&list2, 0));
+ QCOMPARE(list1.at(&list1, 1), list2.at(&list2, 1));
+ delete obj;
+}
+
// QTBUG-7957
void tst_qdeclarativeecmascript::multiEngineObject()
{