diff options
author | Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> | 2015-09-04 13:32:55 +0200 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> | 2015-09-21 13:33:48 +0000 |
commit | c5b083b2a256823f4f47fcaa3140d4f79d99029f (patch) | |
tree | 6a23160e03901fe90f419cf9c6bad9214cb841dd /src/quick | |
parent | 4c1a7050506fddbf0199d928b2e6db7d6a2047ed (diff) |
ListView: Set currentItem's culled state on geometry change
When the viewport is moved, the ListView may cull its currentItem
if it's out of the viewport bounds. However, it could be that this
is only a transient state while the currentItem is being animated.
Unfortunately, we don't uncull the currentItem at any moment during
the animation.
To solve this, we simply set the currentItem's culled state every
time its geometry changes.
Change-Id: I72d548f13f229029ccd8568721ea23e73f7b4392
Task-number: QTBUG-48044
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquicklistview.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index a1d765d6ec..2958c0a67a 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -1401,6 +1401,15 @@ void QQuickListViewPrivate::itemGeometryChanged(QQuickItem *item, const QRectF & if (!q->isComponentComplete()) return; + if (currentItem && currentItem->item == item) { + const bool contentFlowReversed = isContentFlowReversed(); + const qreal pos = position(); + const qreal sz = size(); + const qreal from = contentFlowReversed ? -pos - displayMarginBeginning - sz : pos - displayMarginBeginning; + const qreal to = contentFlowReversed ? -pos + displayMarginEnd : pos + sz + displayMarginEnd; + QQuickItemPrivate::get(currentItem->item)->setCulled(currentItem->endPosition() < from || currentItem->position() > to); + } + if (item != contentItem && (!highlight || item != highlight->item)) { if ((orient == QQuickListView::Vertical && newGeometry.height() != oldGeometry.height()) || (orient == QQuickListView::Horizontal && newGeometry.width() != oldGeometry.width())) { |