summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-08-28 03:22:25 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-08-28 03:22:25 (GMT)
commitd0a9498c3acd66ccbd6feecf9db63414acb77e48 (patch)
tree5e6153e5e51034fd05c90a4f729b7aae382c0299 /src
parent41c9c45f766c187287c3107e8fb121610ccbf3b5 (diff)
downloadQt-d0a9498c3acd66ccbd6feecf9db63414acb77e48.zip
Qt-d0a9498c3acd66ccbd6feecf9db63414acb77e48.tar.gz
Qt-d0a9498c3acd66ccbd6feecf9db63414acb77e48.tar.bz2
Handle QVariantList's in Repeater
This logic needs to be centralized, so that all the various model classes handle the same set of data sources.
Diffstat (limited to 'src')
-rw-r--r--src/declarative/fx/qfxrepeater.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp
index 67d4d69..e6ee242 100644
--- a/src/declarative/fx/qfxrepeater.cpp
+++ b/src/declarative/fx/qfxrepeater.cpp
@@ -257,6 +257,20 @@ void QFxRepeater::regenerate()
if (QFxItem *item = d->addItem(ctxt, lastItem))
lastItem = item;
}
+ } else if (d->dataSource.type() == QMetaType::QVariantList) {
+ QVariantList sl = qvariant_cast<QVariantList>(d->dataSource);
+
+ count = sl.size();
+ for (int ii = 0; ii < count; ++ii) {
+ QmlContext *ctxt = new QmlContext(qmlContext(this), this);
+ d->deletables << ctxt;
+
+ ctxt->setContextProperty(QLatin1String("index"), ii);
+ ctxt->setContextProperty(QLatin1String("modelData"), sl.at(ii));
+
+ if (QFxItem *item = d->addItem(ctxt, lastItem))
+ lastItem = item;
+ }
} else if (QmlMetaType::isList(d->dataSource)) {
count = QmlMetaType::listCount(d->dataSource);
if (count <= 0)