From 181749ff7dcfbeb5eb64026e80353f27013af833 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 13 Jul 2010 16:12:26 +1000 Subject: Ensure the section header isn't shown twice. Happened when currentItem was on a section boundary. Task-number: QTBUG-12089 --- src/declarative/graphicsitems/qdeclarativelistview.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 91e9995..cd26472 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -494,7 +494,7 @@ public: QSmoothedAnimation *highlightSizeAnimator; QDeclarativeViewSection *sectionCriteria; QString currentSection; - static const int sectionCacheSize = 3; + static const int sectionCacheSize = 4; QDeclarativeItem *sectionCache[sectionCacheSize]; qreal spacing; qreal highlightMoveSpeed; @@ -1029,6 +1029,11 @@ void QDeclarativeListViewPrivate::updateCurrent(int modelIndex) } currentItem->item->setFocus(true); currentItem->attached->setIsCurrentItem(true); + // Avoid showing section delegate twice. We still need the section heading so that + // currentItem positioning works correctly. + // This is slightly sub-optimal, but section heading caching minimizes the impact. + if (currentItem->section) + currentItem->section->setVisible(false); } updateHighlight(); emit q->currentIndexChanged(); -- cgit v0.12