diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-07-13 06:12:26 (GMT) |
---|---|---|
committer | Toby Tomkins <toby.tomkins@nokia.com> | 2010-07-14 01:32:14 (GMT) |
commit | 339ae395817867f44736c20df714986e52b8c9a9 (patch) | |
tree | f1eb8399b396977d1d7fe590993543c307e274c9 /src | |
parent | 1131c251882135d1fe90d4f0f91b2b54a4568adf (diff) | |
download | Qt-339ae395817867f44736c20df714986e52b8c9a9.zip Qt-339ae395817867f44736c20df714986e52b8c9a9.tar.gz Qt-339ae395817867f44736c20df714986e52b8c9a9.tar.bz2 |
Ensure the section header isn't shown twice.
Happened when currentItem was on a section boundary.
Task-number: QTBUG-12089
(cherry picked from commit 181749ff7dcfbeb5eb64026e80353f27013af833)
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativelistview.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 9497cb7..9cc414a 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(); |