on xenial help sign in
Improve LVWPH <-> GenericScopeView interaction
c8be7b6Albert Astals Cid
plugins/Dash/listviewwithpageheader.cpp+4−21
@@ -442,15 +442,6 @@ int ListViewWithPageHeader::createdItemCount() const
442 return m_visibleItems.count();
442 return m_visibleItems.count();
443}
443}
444
444
445−QQuickItem *ListViewWithPageHeader::item(int modelIndex) const
446−{
447− ListItem *item = itemAtIndex(modelIndex);
448− if (item)
449− return item->m_item;
450− else
451− return nullptr;
452−}
453−
454bool ListViewWithPageHeader::maximizeVisibleArea(int modelIndex)
445bool ListViewWithPageHeader::maximizeVisibleArea(int modelIndex)
455{
446{
456 ListItem *listItem = itemAtIndex(modelIndex);
447 ListItem *listItem = itemAtIndex(modelIndex);
@@ -772,7 +763,7 @@ QQuickItem *ListViewWithPageHeader::getSectionItem(const QString &sectionText, b
772 delete nobj;
763 delete nobj;
773 } else {
764 } else {
774 sectionItem->setProperty("text", sectionText);
765 sectionItem->setProperty("text", sectionText);
775− sectionItem->setProperty("delegateIndex", -1);
766+ sectionItem->setProperty("delegate", QVariant());
776 sectionItem->setZ(2);
767 sectionItem->setZ(2);
777 QQml_setParent_noEvent(sectionItem, m_clipItem);
768 QQml_setParent_noEvent(sectionItem, m_clipItem);
778 sectionItem->setParentItem(m_clipItem);
769 sectionItem->setParentItem(m_clipItem);
@@ -929,7 +920,7 @@ ListViewWithPageHeader::ListItem *ListViewWithPageHeader::createItem(int modelIn
929 polish();
920 polish();
930 }
921 }
931 if (listItem->sectionItem()) {
922 if (listItem->sectionItem()) {
932− listItem->sectionItem()->setProperty("delegateIndex", modelIndex);
923+ listItem->sectionItem()->setProperty("delegate", QVariant::fromValue(listItem->m_item));
933 }
924 }
934 adjustMinYExtent();
925 adjustMinYExtent();
935 m_contentHeightDirty = true;
926 m_contentHeightDirty = true;
@@ -1123,7 +1114,7 @@ void ListViewWithPageHeader::onModelUpdated(const QQmlChangeSet &changeSet, bool
1123 for (int i = 0; i < m_visibleItems.count(); ++i) {
1114 for (int i = 0; i < m_visibleItems.count(); ++i) {
1124 ListItem *item = m_visibleItems[i];
1115 ListItem *item = m_visibleItems[i];
1125 if (item->sectionItem()) {
1116 if (item->sectionItem()) {
1126− item->sectionItem()->setProperty("delegateIndex", m_firstVisibleIndex + i);
1117+ item->sectionItem()->setProperty("delegate", QVariant::fromValue(item->m_item));
1127 }
1118 }
1128 }
1119 }
1129
1120
@@ -1297,15 +1288,7 @@ void ListViewWithPageHeader::layout()
1297
1288
1298 QQuickItemPrivate::get(m_topSectionItem)->setCulled(false);
1289 QQuickItemPrivate::get(m_topSectionItem)->setCulled(false);
1299 m_topSectionItem->setY(topSectionStickPos);
1290 m_topSectionItem->setY(topSectionStickPos);
1300− int delegateIndex = modelIndex;
1301− // Look for the first index with this section text
1302− while (delegateIndex > 0) {
1303− const QString prevSection = m_delegateModel->stringValue(delegateIndex - 1, m_sectionProperty);
1304− if (prevSection != section)
1305− break;
1306− delegateIndex--;
1307− }
1308− m_topSectionItem->setProperty("delegateIndex", delegateIndex);
1291+ m_topSectionItem->setProperty("delegate", QVariant::fromValue(item->m_item));
1309 if (item->sectionItem()) {
1292 if (item->sectionItem()) {
1310 QQuickItemPrivate::get(item->sectionItem())->setCulled(true);
1293 QQuickItemPrivate::get(item->sectionItem())->setCulled(true);
1311 }
1294 }
plugins/Dash/listviewwithpageheader.h−1
@@ -92,7 +92,6 @@ public:
92 Q_INVOKABLE void showHeader();
92 Q_INVOKABLE void showHeader();
93 Q_INVOKABLE int firstCreatedIndex() const;
93 Q_INVOKABLE int firstCreatedIndex() const;
94 Q_INVOKABLE int createdItemCount() const;
94 Q_INVOKABLE int createdItemCount() const;
95− Q_INVOKABLE QQuickItem *item(int modelIndex) const;
96
95
97 // The index has to be created for this to try to do something
96 // The index has to be created for this to try to do something
98 // Created items are those visible and the precached ones
97 // Created items are those visible and the precached ones
qml/Dash/GenericScopeView.qml+1−2
@@ -623,8 +623,7 @@ FocusScope {
623 sectionProperty: "name"
623 sectionProperty: "name"
624 sectionDelegate: ListItems.Header {
624 sectionDelegate: ListItems.Header {
625 objectName: "dashSectionHeader" + (delegate ? delegate.category : "")
625 objectName: "dashSectionHeader" + (delegate ? delegate.category : "")
626− property int delegateIndex: -1
626+ property var delegate: null
627− readonly property var delegate: categoryView.item(delegateIndex)
628 width: categoryView.width
627 width: categoryView.width
629 height: text != "" ? units.gu(5) : 0
628 height: text != "" ? units.gu(5) : 0
630 color: scopeStyle ? scopeStyle.foreground : theme.palette.normal.baseText
629 color: scopeStyle ? scopeStyle.foreground : theme.palette.normal.baseText
tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp+3−3
@@ -82,7 +82,7 @@ private:
82 QCOMPARE(section(lvwph->m_visibleItems[visibleIndex]->sectionItem()), sectionHeader);
82 QCOMPARE(section(lvwph->m_visibleItems[visibleIndex]->sectionItem()), sectionHeader);
83 if (!sectionHeader.isNull()) {
83 if (!sectionHeader.isNull()) {
84 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->sectionItem())->culled, sectionHeaderCulled);
84 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->sectionItem())->culled, sectionHeaderCulled);
85− QCOMPARE(sectionDelegateIndex(lvwph->m_visibleItems[visibleIndex]->sectionItem()), lvwph->m_firstVisibleIndex + visibleIndex);
85+ QCOMPARE(sectionDelegate(lvwph->m_visibleItems[visibleIndex]->sectionItem()), lvwph->m_visibleItems[visibleIndex]->m_item);
86 }
86 }
87 }
87 }
88
88
@@ -151,9 +151,9 @@ private:
151 return item ? item->property("text").toString() : QString();
151 return item ? item->property("text").toString() : QString();
152 }
152 }
153
153
154− int sectionDelegateIndex(QQuickItem *item)
154+ QQuickItem *sectionDelegate(QQuickItem *item)
155 {
155 {
156− return item ? item->property("delegateIndex").toInt() : -1;
156+ return item ? item->property("delegate").value<QQuickItem *>() : nullptr;
157 }
157 }
158
158
159private Q_SLOTS:
159private Q_SLOTS:
tests/plugins/Dash/listviewwithpageheadersectiontest.cpp+54−54
@@ -39,7 +39,7 @@ private:
39 QCOMPARE(section(lvwph->m_visibleItems[visibleIndex]->sectionItem()), sectionHeader);
39 QCOMPARE(section(lvwph->m_visibleItems[visibleIndex]->sectionItem()), sectionHeader);
40 if (!sectionHeader.isNull()) {
40 if (!sectionHeader.isNull()) {
41 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->sectionItem())->culled, sectionHeaderCulled);
41 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->sectionItem())->culled, sectionHeaderCulled);
42− QCOMPARE(sectionDelegateIndex(lvwph->m_visibleItems[visibleIndex]->sectionItem()), lvwph->m_firstVisibleIndex + visibleIndex);
42+ QCOMPARE(sectionDelegate(lvwph->m_visibleItems[visibleIndex]->sectionItem()), lvwph->m_visibleItems[visibleIndex]->m_item);
43 }
43 }
44 }
44 }
45
45
@@ -116,9 +116,9 @@ private:
116 return item ? item->property("text").toString() : QString();
116 return item ? item->property("text").toString() : QString();
117 }
117 }
118
118
119− int sectionDelegateIndex(QQuickItem *item) const
119+ QQuickItem *sectionDelegate(QQuickItem *item) const
120 {
120 {
121− return item ? item->property("delegateIndex").toInt() : -1;
121+ return item ? item->property("delegate").value<QQuickItem *>() : nullptr;
122 }
122 }
123
123
124private Q_SLOTS:
124private Q_SLOTS:
@@ -220,7 +220,7 @@ private Q_SLOTS:
220 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
220 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
221 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
221 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
222 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
222 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
223− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
223+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
224 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
224 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
225 }
225 }
226
226
@@ -242,7 +242,7 @@ private Q_SLOTS:
242 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
242 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
243 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
243 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
244 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
244 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
245− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
245+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
246 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
246 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
247 }
247 }
248
248
@@ -264,7 +264,7 @@ private Q_SLOTS:
264 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
264 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
265 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
265 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
266 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
266 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
267− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
267+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
268 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
268 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
269
269
270 changeContentY(-30);
270 changeContentY(-30);
@@ -283,7 +283,7 @@ private Q_SLOTS:
283 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
283 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
284 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
284 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
285 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
285 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
286− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
286+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
287 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
287 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
288 }
288 }
289
289
@@ -339,7 +339,7 @@ private Q_SLOTS:
339 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
339 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
340 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
340 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
341 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
341 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
342− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
342+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
343 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
343 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
344
344
345 lvwph->positionAtBeginning();
345 lvwph->positionAtBeginning();
@@ -365,7 +365,7 @@ private Q_SLOTS:
365 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
365 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
366 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
366 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
367 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
367 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
368− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
368+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
369 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
369 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
370
370
371 lvwph->positionAtBeginning();
371 lvwph->positionAtBeginning();
@@ -410,7 +410,7 @@ private Q_SLOTS:
410 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
410 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
411 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
411 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
412 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
412 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
413− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
413+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
414 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
414 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
415
415
416 model->setProperty(0, "size", 400);
416 model->setProperty(0, "size", 400);
@@ -430,7 +430,7 @@ private Q_SLOTS:
430 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
430 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
431 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
431 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
432 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
432 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
433− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
433+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
434 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
434 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
435
435
436 scrollToTop();
436 scrollToTop();
@@ -484,7 +484,7 @@ private Q_SLOTS:
484 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
484 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
485 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
485 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
486 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
486 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
487− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
487+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
488 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
488 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
489
489
490 model->setProperty(0, "size", 400);
490 model->setProperty(0, "size", 400);
@@ -504,7 +504,7 @@ private Q_SLOTS:
504 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
504 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
505 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
505 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
506 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
506 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
507− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
507+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
508 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
508 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
509
509
510 scrollToTop();
510 scrollToTop();
@@ -541,7 +541,7 @@ private Q_SLOTS:
541 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
541 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
542 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
542 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
543 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
543 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
544− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
544+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
545 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
545 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
546
546
547 changeContentY(-30);
547 changeContentY(-30);
@@ -559,7 +559,7 @@ private Q_SLOTS:
559 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
559 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
560 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
560 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
561 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
561 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
562− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
562+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
563 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
563 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
564
564
565 changeContentY(30);
565 changeContentY(30);
@@ -577,7 +577,7 @@ private Q_SLOTS:
577 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
577 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
578 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
578 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
579 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
579 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
580− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
580+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
581 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
581 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
582
582
583 changeContentY(-30);
583 changeContentY(-30);
@@ -595,7 +595,7 @@ private Q_SLOTS:
595 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
595 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
596 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
596 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
597 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
597 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
598− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
598+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
599 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
599 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
600 }
600 }
601
601
@@ -616,7 +616,7 @@ private Q_SLOTS:
616 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
616 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
617 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
617 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
618 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
618 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
619− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
619+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
620 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
620 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
621
621
622 lvwph->setDelegate(otherDelegate);
622 lvwph->setDelegate(otherDelegate);
@@ -675,7 +675,7 @@ private Q_SLOTS:
675 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
675 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
676 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
676 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
677 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
677 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
678− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
678+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
679 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
679 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
680
680
681 scrollToTop();
681 scrollToTop();
@@ -714,7 +714,7 @@ private Q_SLOTS:
714 QTRY_VERIFY(lvwph->isAtYEnd());
714 QTRY_VERIFY(lvwph->isAtYEnd());
715 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
715 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
716 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
716 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
717− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
717+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
718 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
718 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
719
719
720 scrollToTop();
720 scrollToTop();
@@ -751,7 +751,7 @@ private Q_SLOTS:
751 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
751 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
752 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
752 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
753 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
753 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
754− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
754+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
755 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
755 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
756 }
756 }
757
757
@@ -836,7 +836,7 @@ private Q_SLOTS:
836 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
836 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
837 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
837 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
838 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
838 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
839− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
839+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
840 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
840 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
841
841
842 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
842 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
@@ -857,7 +857,7 @@ private Q_SLOTS:
857 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
857 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
858 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
858 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
859 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
859 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
860− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 4);
860+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
861 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
861 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
862
862
863 scrollToTop();
863 scrollToTop();
@@ -898,7 +898,7 @@ private Q_SLOTS:
898 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
898 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
899 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
899 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
900 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
900 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
901− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
901+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
902 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
902 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
903
903
904 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 3), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
904 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 3), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
@@ -919,7 +919,7 @@ private Q_SLOTS:
919 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
919 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
920 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
920 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
921 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
921 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
922− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
922+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
923 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
923 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
924 }
924 }
925
925
@@ -942,7 +942,7 @@ private Q_SLOTS:
942 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
942 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
943 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
943 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
944 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
944 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
945− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
945+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
946 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
946 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
947
947
948 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
948 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
@@ -963,7 +963,7 @@ private Q_SLOTS:
963 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
963 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
964 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
964 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
965 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
965 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
966− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 4);
966+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
967 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
967 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
968 }
968 }
969
969
@@ -986,7 +986,7 @@ private Q_SLOTS:
986 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
986 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
987 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
987 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
988 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
988 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
989− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
989+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
990 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
990 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
991
991
992 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
992 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
@@ -1007,7 +1007,7 @@ private Q_SLOTS:
1007 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1007 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1008 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1008 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1009 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1009 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1010− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
1010+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1011 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1011 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1012
1012
1013 scrollToTop();
1013 scrollToTop();
@@ -1055,7 +1055,7 @@ private Q_SLOTS:
1055 QVERIFY(!lvwph->isAtYEnd());
1055 QVERIFY(!lvwph->isAtYEnd());
1056 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1056 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1057 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1057 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1058− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
1058+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1059 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1059 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1060
1060
1061 scrollToBottom();
1061 scrollToBottom();
@@ -1076,7 +1076,7 @@ private Q_SLOTS:
1076 QVERIFY(lvwph->isAtYEnd());
1076 QVERIFY(lvwph->isAtYEnd());
1077 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1077 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1078 QCOMPARE(section(lvwph->m_topSectionItem), QString("Lazy"));
1078 QCOMPARE(section(lvwph->m_topSectionItem), QString("Lazy"));
1079− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 5);
1079+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1080 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1080 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1081 }
1081 }
1082
1082
@@ -1130,7 +1130,7 @@ private Q_SLOTS:
1130 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1130 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1131 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1131 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1132 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1132 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1133− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 13);
1133+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1134 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1134 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1135
1135
1136 changeContentY(-1700);
1136 changeContentY(-1700);
@@ -1155,7 +1155,7 @@ private Q_SLOTS:
1155 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
1155 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
1156 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1156 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1157 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1157 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1158− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 4);
1158+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[3]->m_item);
1159 QCOMPARE(lvwph->m_topSectionItem->y(), -23.);
1159 QCOMPARE(lvwph->m_topSectionItem->y(), -23.);
1160 }
1160 }
1161
1161
@@ -1217,7 +1217,7 @@ private Q_SLOTS:
1217 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1217 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1218 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1218 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1219 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1219 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1220− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1220+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1221 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1221 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1222 }
1222 }
1223
1223
@@ -1241,7 +1241,7 @@ private Q_SLOTS:
1241 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1241 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1242 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1242 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1243 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1243 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1244− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1244+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1245 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1245 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1246 }
1246 }
1247
1247
@@ -1264,7 +1264,7 @@ private Q_SLOTS:
1264 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1264 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1265 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1265 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1266 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1266 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1267− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1267+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1268 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1268 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1269
1269
1270 QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 1), Q_ARG(QVariant, 1));
1270 QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 1), Q_ARG(QVariant, 1));
@@ -1284,7 +1284,7 @@ private Q_SLOTS:
1284 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1284 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1285 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1285 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1286 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1286 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1287− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1287+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1288 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1288 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1289 }
1289 }
1290
1290
@@ -1307,7 +1307,7 @@ private Q_SLOTS:
1307 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1307 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1308 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1308 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1309 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1309 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1310− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1310+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1311 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1311 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1312
1312
1313 QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 3), Q_ARG(QVariant, 1));
1313 QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 3), Q_ARG(QVariant, 1));
@@ -1327,7 +1327,7 @@ private Q_SLOTS:
1327 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1327 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1328 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1328 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1329 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1329 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1330− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1330+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1331 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1331 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1332 }
1332 }
1333
1333
@@ -1407,7 +1407,7 @@ private Q_SLOTS:
1407 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1407 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1408 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1408 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1409 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1409 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1410− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
1410+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1411 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1411 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1412
1412
1413 QMetaObject::invokeMethod(model, "moveItems", Q_ARG(QVariant, 0), Q_ARG(QVariant, 5), Q_ARG(QVariant, 1));
1413 QMetaObject::invokeMethod(model, "moveItems", Q_ARG(QVariant, 0), Q_ARG(QVariant, 5), Q_ARG(QVariant, 1));
@@ -1428,7 +1428,7 @@ private Q_SLOTS:
1428 QVERIFY(!lvwph->isAtYEnd());
1428 QVERIFY(!lvwph->isAtYEnd());
1429 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1429 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1430 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1430 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1431− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1431+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1432 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1432 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1433 }
1433 }
1434
1434
@@ -1452,7 +1452,7 @@ private Q_SLOTS:
1452 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1452 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1453 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1453 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1454 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1454 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1455− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1455+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[2]->m_item);
1456 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1456 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1457
1457
1458 model->setProperty(1, "size", 100);
1458 model->setProperty(1, "size", 100);
@@ -1473,7 +1473,7 @@ private Q_SLOTS:
1473 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1473 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1474 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1474 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1475 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1475 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1476− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1476+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[2]->m_item);
1477 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1477 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1478 }
1478 }
1479
1479
@@ -1512,7 +1512,7 @@ private Q_SLOTS:
1512 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
1512 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
1513 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1513 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1514 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
1514 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
1515− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
1515+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
1516 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1516 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1517
1517
1518 scrollToTop();
1518 scrollToTop();
@@ -1551,7 +1551,7 @@ private Q_SLOTS:
1551 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1551 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1552 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1552 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1553 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1553 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1554− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1554+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1555 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1555 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1556
1556
1557 lvwph->showHeader();
1557 lvwph->showHeader();
@@ -1572,7 +1572,7 @@ private Q_SLOTS:
1572 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
1572 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
1573 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1573 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1574 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1574 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1575− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1575+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1576 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1576 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1577
1577
1578 scrollToTop();
1578 scrollToTop();
@@ -1759,7 +1759,7 @@ private Q_SLOTS:
1759 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1759 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1760 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1760 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1761 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
1761 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
1762− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
1762+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1763 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1763 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1764 }
1764 }
1765
1765
@@ -1784,7 +1784,7 @@ private Q_SLOTS:
1784 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1784 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1785 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1785 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1786 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1786 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1787− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1787+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1788 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1788 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1789 }
1789 }
1790
1790
@@ -1892,7 +1892,7 @@ private Q_SLOTS:
1892 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1892 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1893 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1893 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1894 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1894 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1895− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1895+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
1896 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1896 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1897 }
1897 }
1898
1898
@@ -1914,7 +1914,7 @@ private Q_SLOTS:
1914 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1914 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1915 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1915 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1916 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1916 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1917− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1917+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
1918 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1918 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1919
1919
1920 bool res = lvwph->maximizeVisibleArea(1);
1920 bool res = lvwph->maximizeVisibleArea(1);
@@ -1934,7 +1934,7 @@ private Q_SLOTS:
1934 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1934 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1935 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1935 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1936 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1936 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1937− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1937+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
1938 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1938 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1939 }
1939 }
1940
1940
@@ -1987,7 +1987,7 @@ private Q_SLOTS:
1987 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1987 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1988 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1988 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1989 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1989 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1990− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1990+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
1991 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1991 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1992 }
1992 }
1993
1993
@@ -2014,7 +2014,7 @@ private Q_SLOTS:
2014 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
2014 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
2015 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
2015 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
2016 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
2016 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
2017− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
2017+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
2018 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
2018 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
2019
2019
2020 changeContentY(20);
2020 changeContentY(20);
@@ -2037,7 +2037,7 @@ private Q_SLOTS:
2037 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
2037 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
2038 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
2038 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
2039 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
2039 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
2040− QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
2040+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
2041 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
2041 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
2042 }
2042 }
2043
2043