aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickitemview.cpp
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2012-05-03 13:42:13 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-09 03:26:54 +0200
commit21311d3a352adcdb8c2e9f9c5af637e54293b6a8 (patch)
tree2976a69ac9d1b8b3024de9f25211ad38cc838de0 /src/quick/items/qquickitemview.cpp
parentdfc4e6f93bd2482b6eb79d7088850ceb460a1928 (diff)
Move check for whether a layout is already in progress
Move it out of applyModelChanges() into layout() since that's where it should really be checked. Change-Id: I24093e91e2ffadd5377ba44128168939e5db54c9 Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Diffstat (limited to 'src/quick/items/qquickitemview.cpp')
-rw-r--r--src/quick/items/qquickitemview.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 2a26e853cb..1b48a32fe6 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -1093,14 +1093,14 @@ void QQuickItemViewPrivate::itemGeometryChanged(QQuickItem *item, const QRectF &
if (currentItem && currentItem->item == item) {
// don't allow item movement transitions to trigger a re-layout and
// start new transitions
- bool prevDisableLayout = disableLayout;
- if (!disableLayout) {
+ bool prevInLayout = inLayout;
+ if (!inLayout) {
FxViewItem *actualItem = transitioner ? visibleItem(currentIndex) : 0;
if (actualItem && actualItem->transitionRunning())
- disableLayout = true;
+ inLayout = true;
}
updateHighlight();
- disableLayout = prevDisableLayout;
+ inLayout = prevInLayout;
}
if (trackedItem && trackedItem->item == item)
@@ -1154,7 +1154,7 @@ void QQuickItemView::modelUpdated(const QQuickChangeSet &changeSet, bool reset)
polish();
}
} else {
- if (d->disableLayout) {
+ if (d->inLayout) {
d->bufferedChanges.prepare(d->currentIndex, d->itemCount);
d->bufferedChanges.applyChanges(changeSet);
} else {
@@ -1419,7 +1419,7 @@ QQuickItemViewPrivate::QQuickItemViewPrivate()
, transitioner(0)
, minExtent(0), maxExtent(0)
, ownModel(false), wrap(false)
- , disableLayout(false), inViewportMoved(false), forceLayout(false), currentIndexCleared(false)
+ , inLayout(false), inViewportMoved(false), forceLayout(false), currentIndexCleared(false)
, haveHighlightRange(false), autoHighlight(true), highlightRangeStartValid(false), highlightRangeEndValid(false)
, fillCacheBuffer(false), inRequest(false), requestedAsync(false)
, runDelayedRemoveTransition(false)
@@ -1721,14 +1721,17 @@ void QQuickItemViewPrivate::updateViewport()
void QQuickItemViewPrivate::layout()
{
Q_Q(QQuickItemView);
- if (disableLayout)
+ if (inLayout)
return;
+ inLayout = true;
+
if (!isValid() && !visibleItems.count()) {
clear();
setPosition(contentStartOffset());
if (transitioner)
transitioner->setPopulateTransitionEnabled(false);
+ inLayout = false;
return;
}
@@ -1747,6 +1750,7 @@ void QQuickItemViewPrivate::layout()
fillCacheBuffer = false;
refill();
}
+ inLayout = false;
return;
}
forceLayout = false;
@@ -1806,16 +1810,15 @@ void QQuickItemViewPrivate::layout()
}
runDelayedRemoveTransition = false;
+ inLayout = false;
}
bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult, ChangeResult *totalRemovalResult)
{
Q_Q(QQuickItemView);
- if (!q->isComponentComplete() || !hasPendingChanges() || disableLayout)
+ if (!q->isComponentComplete() || !hasPendingChanges())
return false;
- disableLayout = true;
-
if (bufferedChanges.hasPendingChanges()) {
currentChanges.applyBufferedChanges(bufferedChanges);
bufferedChanges.reset();
@@ -1957,7 +1960,6 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult
if (!visibleAffected && viewportChanged)
updateViewport();
- disableLayout = false;
return visibleAffected;
}