aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@digia.com>2014-07-21 14:55:30 +0200
committerMitch Curtis <mitch.curtis@digia.com>2014-07-24 10:17:13 +0200
commit1416e6bd3ec4aaefe33bb64c9ad64d251f7f2885 (patch)
tree9c3ad42a4d18e543473ce57e925fe4b7f985c5ad /src
parentbca2eb550de0148dc53aeb1f9e7a036a692fd01d (diff)
Schedule layout changes to avoid refill() recursion.
Otherwise we add duplicate item delegates. Task-number: QTBUG-40298 Change-Id: I8a2221d72f458c892720a71d87513808a5d725a6 Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquickpathview.cpp10
-rw-r--r--src/quick/items/qquickpathview_p_p.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index 45cd8e184c..335e7611f1 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -104,6 +104,7 @@ QQuickPathViewPrivate::QQuickPathViewPrivate()
, stealMouse(false), ownModel(false), interactive(true), haveHighlightRange(true)
, autoHighlight(true), highlightUp(false), layoutScheduled(false)
, moving(false), flicking(false), dragging(false), inRequest(false), delegateValidated(false)
+ , inRefill(false)
, dragMargin(0), deceleration(100), maximumFlickVelocity(QML_FLICK_DEFAULTMAXVELOCITY)
, moveOffset(this, &QQuickPathViewPrivate::setAdjustedOffset), flickDuration(0)
, firstIndex(-1), pathItems(-1), requestedIndex(-1), cacheSize(0), requestedZ(0)
@@ -1873,11 +1874,18 @@ void QQuickPathView::refill()
{
Q_D(QQuickPathView);
+ if (d->inRefill) {
+ d->scheduleLayout();
+ return;
+ }
+
d->layoutScheduled = false;
if (!d->isValid() || !isComponentComplete())
return;
+ d->inRefill = true;
+
bool currentVisible = false;
int count = d->pathItems == -1 ? d->modelCount : qMin(d->pathItems, d->modelCount);
@@ -2010,6 +2018,8 @@ void QQuickPathView::refill()
}
while (d->itemCache.count())
d->releaseItem(d->itemCache.takeLast());
+
+ d->inRefill = false;
}
void QQuickPathView::modelUpdated(const QQmlChangeSet &changeSet, bool reset)
diff --git a/src/quick/items/qquickpathview_p_p.h b/src/quick/items/qquickpathview_p_p.h
index 813f472072..e21f3757e6 100644
--- a/src/quick/items/qquickpathview_p_p.h
+++ b/src/quick/items/qquickpathview_p_p.h
@@ -152,6 +152,7 @@ public:
bool requestedOnPath : 1;
bool inRequest : 1;
bool delegateValidated : 1;
+ bool inRefill : 1;
QElapsedTimer timer;
qint64 lastPosTime;
QPointF lastPos;