diff options
-rw-r--r-- | src/quick/items/qquicklistview.cpp | 11 | ||||
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 10 |
2 files changed, 12 insertions, 9 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 diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 1218d3cfcb..1ef895d111 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -2120,13 +2120,13 @@ void tst_QQuickListView::sectionsPositioning() QVERIFY(bottomItem); QCOMPARE(bottomItem->y(), 380.); - // Change current section + // Change current section, and verify case insensitive comparison listview->setContentY(10); model.modifyItem(0, "One", "aaa"); - model.modifyItem(1, "Two", "aaa"); - model.modifyItem(2, "Three", "aaa"); - model.modifyItem(3, "Four", "aaa"); - model.modifyItem(4, "Five", "aaa"); + model.modifyItem(1, "Two", "AAA"); + model.modifyItem(2, "Three", "aAa"); + model.modifyItem(3, "Four", "aaA"); + model.modifyItem(4, "Five", "Aaa"); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QTRY_COMPARE(listview->currentSection(), QString("aaa")); |