aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2014-10-29 13:59:46 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2014-10-29 21:50:12 +0100
commitcf959b4b4ea3d2dfd5243022fea393fadfd95b0d (patch)
tree15191c98807e379e57267cfb5bf7a28bd53d4c83 /src/quick
parent4b7dc1cf59da656be1f51a5a7bdac01b1ae8219a (diff)
Repeater & itemviews: fix setModel() JS array handling
QVariant comparison in setModel() started failing because JS arrays are now passed as a QJSValue. Re-assigning the same array content should not trigger a model change. This change restores the old behavior it had before, when JS arrays were passed as QVariantLists. Change-Id: I1882b3531f2893b116dbd817edeecab1ae812ce8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquickitemview.cpp6
-rw-r--r--src/quick/items/qquickpathview.cpp6
-rw-r--r--src/quick/items/qquickrepeater.cpp6
3 files changed, 15 insertions, 3 deletions
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 2fd79715e1..93cb5e4e9d 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -273,9 +273,13 @@ QVariant QQuickItemView::model() const
return d->modelVariant;
}
-void QQuickItemView::setModel(const QVariant &model)
+void QQuickItemView::setModel(const QVariant &m)
{
Q_D(QQuickItemView);
+ QVariant model = m;
+ if (model.userType() == qMetaTypeId<QJSValue>())
+ model = model.value<QJSValue>().toVariant();
+
if (d->modelVariant == model)
return;
if (d->model) {
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index 825845eca9..6cf3e33de9 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -607,9 +607,13 @@ QVariant QQuickPathView::model() const
return d->modelVariant;
}
-void QQuickPathView::setModel(const QVariant &model)
+void QQuickPathView::setModel(const QVariant &m)
{
Q_D(QQuickPathView);
+ QVariant model = m;
+ if (model.userType() == qMetaTypeId<QJSValue>())
+ model = model.value<QJSValue>().toVariant();
+
if (d->modelVariant == model)
return;
diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp
index 8e13947d78..e2a3043857 100644
--- a/src/quick/items/qquickrepeater.cpp
+++ b/src/quick/items/qquickrepeater.cpp
@@ -183,9 +183,13 @@ QVariant QQuickRepeater::model() const
return d->dataSource;
}
-void QQuickRepeater::setModel(const QVariant &model)
+void QQuickRepeater::setModel(const QVariant &m)
{
Q_D(QQuickRepeater);
+ QVariant model = m;
+ if (model.userType() == qMetaTypeId<QJSValue>())
+ model = model.value<QJSValue>().toVariant();
+
if (d->dataSource == model)
return;