aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickitemview.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-12-09 01:01:09 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-12-09 12:22:24 +0000
commit8182a8044f3b9e6c25c3b50b1c7f34d2900a3207 (patch)
tree22489011cb506ada47b8a71d403d3f128bad4f10 /src/quick/items/qquickitemview.cpp
parent3c4247e1e021b6bcc480afc0716e0231575d0501 (diff)
parent51e02fdc02c3cc2dbf9d2ba0b3fb709a6cd4e32e (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: src/qml/common/qv4compileddata_p.h Change-Id: I1150c8cd0161f0e22137d383013751394ae64e18
Diffstat (limited to 'src/quick/items/qquickitemview.cpp')
-rw-r--r--src/quick/items/qquickitemview.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 7f228e1c05..05cdc1749d 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -239,7 +239,9 @@ void QQuickItemView::setModel(const QVariant &m)
if (isComponentComplete()) {
d->updateSectionCriteria();
d->refill();
- d->currentIndex = -1;
+ /* Setting currentIndex to -2 ensures that we always enter the "currentIndex changed"
+ code path in setCurrentIndex, updating bindings depending on currentIndex.*/
+ d->currentIndex = -2;
setCurrentIndex(d->model->count() > 0 ? 0 : -1);
d->updateViewport();