diff options
author | Martin Jones <[email protected]> | 2012-03-28 09:17:02 +1000 |
---|---|---|
committer | Qt by Nokia <[email protected]> | 2012-03-28 03:10:14 +0200 |
commit | 4f08f48017bf4fe17b23bd5d7399bce4bd37d806 (patch) | |
tree | b3b2b9f5118da8a0612808f128fe5f33be62ab0c /src/quick/items/qquicklistview.cpp | |
parent | 7d1996c1f44c75159b7dc3040dd458ba533cc665 (diff) |
Section comparison should be case insensitive.
Allows use of mixed case model data without having to add a
special role just for sectioning.
Change-Id: I0a747e51542b5bf0f9db8fc2732882928a6cc676
Reviewed-by: Bea Lam <[email protected]>
Diffstat (limited to 'src/quick/items/qquicklistview.cpp')
-rw-r--r-- | src/quick/items/qquicklistview.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 6f33545185..1cc2637fe6 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -577,7 +577,7 @@ void QQuickListViewPrivate::initializeViewItem(FxViewItem *item) itemPrivate->addItemChangeListener(this, QQuickItemPrivate::Geometry); if (sectionCriteria && sectionCriteria->delegate()) { - if (item->attached->m_prevSection != item->attached->m_section) + if (QString::compare(item->attached->m_prevSection, item->attached->m_section, Qt::CaseInsensitive)) updateInlineSection(static_cast<FxListItemSG*>(item)); } } @@ -962,7 +962,7 @@ void QQuickListViewPrivate::updateInlineSection(FxListItemSG *listItem) { if (!sectionCriteria || !sectionCriteria->delegate()) return; - if (listItem->attached->m_prevSection != listItem->attached->m_section + if (QString::compare(listItem->attached->m_prevSection, listItem->attached->m_section, Qt::CaseInsensitive) && (sectionCriteria->labelPositioning() & QQuickViewSection::InlineLabels || (listItem->index == 0 && sectionCriteria->labelPositioning() & QQuickViewSection::CurrentLabelAtStart))) { if (!listItem->section()) { @@ -1022,7 +1022,7 @@ void QQuickListViewPrivate::updateStickySections() if (sectionCriteria->labelPositioning() & QQuickViewSection::CurrentLabelAtStart && isValid() && visibleItems.count()) { if (!currentSectionItem) { currentSectionItem = getSectionItem(currentSection); - } else if (currentStickySection != currentSection) { + } else if (QString::compare(currentStickySection, currentSection, Qt::CaseInsensitive)) { QQmlContext *context = QQmlEngine::contextForObject(currentSectionItem)->parentContext(); context->setContextProperty(QLatin1String("section"), currentSection); } @@ -1055,7 +1055,7 @@ void QQuickListViewPrivate::updateStickySections() if (sectionCriteria->labelPositioning() & QQuickViewSection::NextLabelAtEnd && isValid() && visibleItems.count()) { if (!nextSectionItem) { nextSectionItem = getSectionItem(nextSection); - } else if (nextStickySection != nextSection) { + } else if (QString::compare(nextStickySection, nextSection, Qt::CaseInsensitive)) { QQmlContext *context = QQmlEngine::contextForObject(nextSectionItem)->parentContext(); context->setContextProperty(QLatin1String("section"), nextSection); } @@ -2040,6 +2040,9 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation) sections, etc. for an address book) \endlist + A case insensitive comparison is used when determining section + boundaries. + \c section.delegate holds the delegate component for each section. \c section.labelPositioning determines whether the current and/or |