diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-08-28 08:51:57 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-08-28 08:51:57 (GMT) |
commit | 5e4f14aa0f2413143b4f3503e73a6180d5d990d8 (patch) | |
tree | 6803e43fab30dac67a310af17eca1d51ac12c0ec /src/declarative/util | |
parent | fa44c4d01d9a7a1aa71ab9828890b591e89ef844 (diff) | |
download | Qt-5e4f14aa0f2413143b4f3503e73a6180d5d990d8.zip Qt-5e4f14aa0f2413143b4f3503e73a6180d5d990d8.tar.gz Qt-5e4f14aa0f2413143b4f3503e73a6180d5d990d8.tar.bz2 |
Support QVariantList in QmlListAccessor
Diffstat (limited to 'src/declarative/util')
-rw-r--r-- | src/declarative/util/qmllistaccessor.cpp | 22 | ||||
-rw-r--r-- | src/declarative/util/qmllistaccessor.h | 2 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qmllistaccessor.cpp index da54b6e..0332b9e 100644 --- a/src/declarative/util/qmllistaccessor.cpp +++ b/src/declarative/util/qmllistaccessor.cpp @@ -68,6 +68,8 @@ void QmlListAccessor::setList(const QVariant &v) type = Invalid; } else if (d.type() == QVariant::StringList) { type = StringList; + } else if (d.type() == QMetaType::QVariantList) { + type = VariantList; } else if (d.type() != QVariant::UserType) { type = Instance; } else if (QmlMetaType::isObject(d.userType())) { @@ -92,6 +94,8 @@ int QmlListAccessor::count() const return 0; case StringList: return qvariant_cast<QStringList>(d).count(); + case VariantList: + return qvariant_cast<QVariantList>(d).count(); case QmlList: { QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData(); @@ -114,6 +118,8 @@ QVariant QmlListAccessor::at(int idx) const return QVariant(); case StringList: return QVariant::fromValue(qvariant_cast<QStringList>(d).at(idx)); + case VariantList: + return qvariant_cast<QVariantList>(d).at(idx); case QmlList: { QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData(); @@ -141,6 +147,11 @@ void QmlListAccessor::append(const QVariant &value) qvariant_cast<QStringList>(d).append(str); break; } + case VariantList: + { + qvariant_cast<QVariantList>(d).append(value); + break; + } case QmlList: { QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData(); @@ -167,6 +178,11 @@ void QmlListAccessor::insert(int index, const QVariant &value) qvariant_cast<QStringList>(d).insert(index, str); break; } + case VariantList: + { + qvariant_cast<QVariantList>(d).insert(index, value); + break; + } case QmlList: { QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData(); @@ -193,6 +209,9 @@ void QmlListAccessor::removeAt(int index) case StringList: qvariant_cast<QStringList>(d).removeAt(index); break; + case VariantList: + qvariant_cast<QVariantList>(d).removeAt(index); + break; case QmlList: { QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData(); @@ -219,6 +238,9 @@ void QmlListAccessor::clear() case StringList: qvariant_cast<QStringList>(d).clear(); break; + case VariantList: + qvariant_cast<QVariantList>(d).clear(); + break; case QmlList: { QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData(); diff --git a/src/declarative/util/qmllistaccessor.h b/src/declarative/util/qmllistaccessor.h index 27a77a0..c3017e1 100644 --- a/src/declarative/util/qmllistaccessor.h +++ b/src/declarative/util/qmllistaccessor.h @@ -70,7 +70,7 @@ public: virtual void clear(); private: - enum Type { Invalid, StringList, QmlList, QList, Instance }; + enum Type { Invalid, StringList, VariantList, QmlList, QList, Instance }; Type type; QVariant d; }; |