diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-10-21 17:04:16 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-10-22 09:44:55 +0000 |
commit | 9880e74a0c01a6af6c6ab2facc2ad683d3281c90 (patch) | |
tree | 1275d9f1bb389b6a5af75c5fd793c0510b39c229 /src/quick/items/qquickpathview.cpp | |
parent | ddc8537ec17591e4b51293523c1369823ecd8a83 (diff) | |
download | qtdeclarative-9880e74a0c01a6af6c6ab2facc2ad683d3281c90.tar.gz |
Fix QQuickPathViewPrivate::snapToIndex()
QQuickPathView::setCurrentIndex() set moveReason to "SetIndex", but
snapToIndex() overrode it to "Other". This caused updateCurrent() to
change the current index during snap animation and caused binding
loops in Qt Quick Controls 2.
Change-Id: I6c5f34c69886cb5c234ed78535bb356fbb38b3a6
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/quick/items/qquickpathview.cpp')
-rw-r--r-- | src/quick/items/qquickpathview.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index 302532c3d1..05bf50574c 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -753,7 +753,7 @@ void QQuickPathView::setCurrentIndex(int idx) if (d->modelCount) { d->createCurrentItem(); if (d->haveHighlightRange && d->highlightRangeMode == QQuickPathView::StrictlyEnforceRange) - d->snapToIndex(d->currentIndex); + d->snapToIndex(d->currentIndex, QQuickPathViewPrivate::SetIndex); d->currentItemOffset = d->positionOfIndex(d->currentIndex); d->updateHighlight(); } @@ -988,7 +988,7 @@ void QQuickPathView::setHighlightRangeMode(HighlightRangeMode mode) d->regenerate(); int index = d->highlightRangeMode != NoHighlightRange ? d->currentIndex : d->calcCurrentIndex(); if (index >= 0) - d->snapToIndex(index); + d->snapToIndex(index, QQuickPathViewPrivate::Other); } emit highlightRangeModeChanged(); } @@ -2306,12 +2306,12 @@ void QQuickPathViewPrivate::fixOffset() if (curr != currentIndex && highlightRangeMode == QQuickPathView::StrictlyEnforceRange) q->setCurrentIndex(curr); else - snapToIndex(curr); + snapToIndex(curr, Other); } } } -void QQuickPathViewPrivate::snapToIndex(int index) +void QQuickPathViewPrivate::snapToIndex(int index, MovementReason reason) { if (!model || modelCount <= 0) return; @@ -2321,7 +2321,7 @@ void QQuickPathViewPrivate::snapToIndex(int index) if (offset == targetOffset) return; - moveReason = Other; + moveReason = reason; offsetAdj = 0.0; tl.reset(moveOffset); moveOffset.setValue(offset); |