From 2b5e9534450404fba3bdf89f304d0504ae8587dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Tue, 30 Sep 2014 13:23:56 +0100 Subject: PathView: Fix QML engine thinking currentItem is null when it's not QML didn't re-evaluate any bindings using currentItem because a notification was missing. Change-Id: Icdaa3022e0b01644a060e577d87f011b4ea9fabb Reviewed-by: Alan Alpert --- src/quick/items/qquickpathview.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/quick/items/qquickpathview.cpp') diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index 00a5400eb2..825845eca9 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -1987,12 +1987,14 @@ void QQuickPathView::refill() } } + bool currentChanged = false; if (!currentVisible) { d->currentItemOffset = 1.0; if (d->currentItem) { d->updateItem(d->currentItem, 1.0); } else if (!waiting && d->currentIndex >= 0 && d->currentIndex < d->modelCount) { if ((d->currentItem = d->getItem(d->currentIndex, d->currentIndex))) { + currentChanged = true; d->updateItem(d->currentItem, 1.0); if (QQuickPathViewAttached *att = d->attached(d->currentItem)) att->setIsCurrentItem(true); @@ -2000,6 +2002,7 @@ void QQuickPathView::refill() } } else if (!waiting && !d->currentItem) { if ((d->currentItem = d->getItem(d->currentIndex, d->currentIndex))) { + currentChanged = true; d->currentItem->setFocus(true); if (QQuickPathViewAttached *att = d->attached(d->currentItem)) att->setIsCurrentItem(true); @@ -2019,6 +2022,8 @@ void QQuickPathView::refill() d->releaseItem(d->itemCache.takeLast()); d->inRefill = false; + if (currentChanged) + emit currentItemChanged(); } void QQuickPathView::modelUpdated(const QQmlChangeSet &changeSet, bool reset) -- cgit v1.2.3