diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-09-22 07:26:45 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-09-22 07:26:45 (GMT) |
commit | 6b2e0b4c5851a156c1f5fa0f73e9b1266ddc6930 (patch) | |
tree | 31616634bec2095cf16e82df9109cd6beda59460 /src/declarative/qml/qmlvmemetaobject.cpp | |
parent | c4c12f947b0480fd0695e1885ebec9ab496f6bf4 (diff) | |
download | Qt-6b2e0b4c5851a156c1f5fa0f73e9b1266ddc6930.zip Qt-6b2e0b4c5851a156c1f5fa0f73e9b1266ddc6930.tar.gz Qt-6b2e0b4c5851a156c1f5fa0f73e9b1266ddc6930.tar.bz2 |
Preliminary support for object and list synthesized property types
Diffstat (limited to 'src/declarative/qml/qmlvmemetaobject.cpp')
-rw-r--r-- | src/declarative/qml/qmlvmemetaobject.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qmlvmemetaobject.cpp index 9ce63b1..f473743 100644 --- a/src/declarative/qml/qmlvmemetaobject.cpp +++ b/src/declarative/qml/qmlvmemetaobject.cpp @@ -74,11 +74,16 @@ QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj, data = new QVariant[metaData->propertyCount]; aConnected.resize(metaData->aliasCount); + int list_type = qMetaTypeId<QmlList<QObject*>* >(); // ### Optimize for (int ii = 0; ii < metaData->propertyCount; ++ii) { int t = (metaData->propertyData() + ii)->propertyType; - if (t != -1) + if (t == list_type) { + listProperties.append(new List(this, ii)); + data[ii] = QVariant::fromValue((QmlList<QObject *>*)listProperties.last()); + } else if (t != -1) { data[ii] = QVariant((QVariant::Type)t); + } } } @@ -88,6 +93,7 @@ QmlVMEMetaObject::~QmlVMEMetaObject() ref->release(); if (parent) delete parent; + qDeleteAll(listProperties); delete [] data; } @@ -137,9 +143,15 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) case QVariant::Date: *reinterpret_cast<QDate *>(a[0]) = data[id].toDate(); break; + case QMetaType::QObjectStar: + *reinterpret_cast<QObject **>(a[0]) = data[id].value<QObject*>(); + break; default: break; } + if (t == qMetaTypeId<QmlList<QObject*>* >()) { + *reinterpret_cast<QmlList<QObject *> **>(a[0]) = data[id].value<QmlList<QObject*>*>(); + } } else if (c == QMetaObject::WriteProperty) { @@ -236,4 +248,9 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) return object->qt_metacall(c, _id, a); } +void QmlVMEMetaObject::listChanged(int id) +{ + activate(object, methodOffset + id, 0); +} + QT_END_NAMESPACE |