summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-10-08 01:46:36 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-10-08 01:46:36 (GMT)
commit0bf05331d901ca27e358ec22569a07489a70b7a5 (patch)
treee806bbbafb2ac086d1ce40691b0532d0cce104fe /src/declarative
parente72192e778a6670bd1384a4e5ab7012ac1525f1a (diff)
downloadQt-0bf05331d901ca27e358ec22569a07489a70b7a5.zip
Qt-0bf05331d901ca27e358ec22569a07489a70b7a5.tar.gz
Qt-0bf05331d901ca27e358ec22569a07489a70b7a5.tar.bz2
emit currentSectionChanged when section changes in ListView.
Task-number: QTBUG-13981 Reviewed-by: Michael Brasser
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 6b46bc5..4943aef 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -1009,18 +1009,27 @@ void QDeclarativeListViewPrivate::updateSections()
void QDeclarativeListViewPrivate::updateCurrentSection()
{
+ Q_Q(QDeclarativeListView);
if (!sectionCriteria || visibleItems.isEmpty()) {
- currentSection.clear();
+ if (!currentSection.isEmpty()) {
+ currentSection.clear();
+ emit q->currentSectionChanged();
+ }
return;
}
int index = 0;
while (index < visibleItems.count() && visibleItems.at(index)->endPosition() < position())
++index;
+ QString newSection = currentSection;
if (index < visibleItems.count())
- currentSection = visibleItems.at(index)->attached->section();
+ newSection = visibleItems.at(index)->attached->section();
else
- currentSection = visibleItems.first()->attached->section();
+ newSection = visibleItems.first()->attached->section();
+ if (newSection != currentSection) {
+ currentSection = newSection;
+ emit q->currentSectionChanged();
+ }
}
void QDeclarativeListViewPrivate::updateCurrent(int modelIndex)