diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-07-17 03:00:30 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-07-17 09:45:48 +0000 |
commit | d96bd6069c6d24c12f0a3d96466e50b4d1a09ac4 (patch) | |
tree | b1250acd86c482fc92cd90d1733f0a436d1c2a78 /src/quicktemplates2/qquicktumbler.cpp | |
parent | 1567e4581e1f82dae011d6d3b2e4196efc93b0f4 (diff) | |
parent | 449c9c2474da0461c14e7d6ea12ff4e35c3c7aae (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
src/quickcontrols2/qquickstyle.cpp
src/quicktemplates2/qquickscrollview.cpp
tests/auto/qquickstyle/tst_qquickstyle.cpp
Change-Id: I9afddf07a956f43cf0445e91b8d1a02f167b6bd5
Diffstat (limited to 'src/quicktemplates2/qquicktumbler.cpp')
-rw-r--r-- | src/quicktemplates2/qquicktumbler.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp index 75520375..25710231 100644 --- a/src/quicktemplates2/qquicktumbler.cpp +++ b/src/quicktemplates2/qquicktumbler.cpp @@ -215,7 +215,7 @@ void QQuickTumblerPrivate::_q_onViewCountChanged() // If we could successfully set the currentIndex, consider it done. // Otherwise, we'll try again later in updatePolish(). if (currentIndex == pendingCurrentIndex) - pendingCurrentIndex = -1; + setPendingCurrentIndex(-1); else q->polish(); } else if (currentIndex == -1) { @@ -639,7 +639,7 @@ void QQuickTumblerPrivate::syncCurrentIndex() // Nothing to do. if (actualViewIndex == indexToSet) { - pendingCurrentIndex = -1; + setPendingCurrentIndex(-1); return; } @@ -652,11 +652,16 @@ void QQuickTumblerPrivate::syncCurrentIndex() ignoreCurrentIndexChanges = false; if (view->property("currentIndex").toInt() == indexToSet) - pendingCurrentIndex = -1; + setPendingCurrentIndex(-1); else if (isPendingCurrentIndex) q->polish(); } +void QQuickTumblerPrivate::setPendingCurrentIndex(int index) +{ + pendingCurrentIndex = index; +} + void QQuickTumblerPrivate::setCurrentIndex(int newCurrentIndex, QQuickTumblerPrivate::PropertyChangeReason changeReason) { @@ -666,7 +671,7 @@ void QQuickTumblerPrivate::setCurrentIndex(int newCurrentIndex, if (!q->isComponentComplete()) { // Views can't set currentIndex until they're ready. - pendingCurrentIndex = newCurrentIndex; + setPendingCurrentIndex(newCurrentIndex); return; } @@ -675,7 +680,7 @@ void QQuickTumblerPrivate::setCurrentIndex(int newCurrentIndex, // the model is in the process of being set and the user has set // the currentIndex in onModelChanged. We have to queue the currentIndex // change until we're ready. - pendingCurrentIndex = newCurrentIndex; + setPendingCurrentIndex(newCurrentIndex); return; } @@ -814,7 +819,7 @@ void QQuickTumbler::updatePolish() // If the count is still 0, it's not going to happen. if (d->count == 0) { - d->pendingCurrentIndex = -1; + d->setPendingCurrentIndex(-1); return; } @@ -829,7 +834,7 @@ void QQuickTumbler::updatePolish() d->setCurrentIndex(0); } - d->pendingCurrentIndex = -1; + d->setPendingCurrentIndex(-1); } } |