Merge lp:~aacid/unity8/dashSectionDelegateUpdateFix into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Michael Zanetti
Approved revision: 2657
Merged at revision: 2680
Proposed branch: lp:~aacid/unity8/dashSectionDelegateUpdateFix
Merge into: lp:unity8
Diff against target: 569 lines (+62/-71)
4 files modified
plugins/Dash/listviewwithpageheader.cpp (+4/-12)
qml/Dash/GenericScopeView.qml (+1/-2)
tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp (+3/-3)
tests/plugins/Dash/listviewwithpageheadersectiontest.cpp (+54/-54)
To merge this branch: bzr merge lp:~aacid/unity8/dashSectionDelegateUpdateFix
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Approve
Paweł Stołowski (community) Approve
Unity8 CI Bot continuous-integration Approve
Review via email: mp+307798@code.launchpad.net

Commit message

Improve LVWPH <-> GenericScopeView interaction

Send up directly the delegate instead of the delegateIndex and then asking back for the delegate

Saves time and also if the delegateIndex is the same number but the delegate different the delegate won't be updated because QML doesn't know it's different

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2656
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2328/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3065
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1711
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1711
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1711
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3093
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2950
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2950/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2950
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2950/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2950
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2950/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2950
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2950/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2950
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2950/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2950
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2950/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2950
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2950/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2950
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2950/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2950
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2950/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2328/rebuild

review: Needs Fixing (continuous-integration)
2657. By Albert Astals Cid

item() function is still needed on other parts of GenericScopeView ^_^

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2657
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2330/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3068
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1714
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1714
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1714
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3096
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2953
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2953/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2953
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2953/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2953
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2953/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2953
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2953/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2953
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2953/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2953
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2953/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2953
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2953/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2953
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2953/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2953
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2953/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2330/rebuild

review: Approve (continuous-integration)
Revision history for this message
Paweł Stołowski (stolowski) wrote :

I've tested the resulting debs for this MP and I can't reproduce the issue with it anymore, thanks! +1 from me.

review: Approve
Revision history for this message
Michael Zanetti (mzanetti) wrote :

Code looks sane to me

* tested by Pawel

* CI is happy too

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Dash/listviewwithpageheader.cpp'
2--- plugins/Dash/listviewwithpageheader.cpp 2016-09-22 07:35:29 +0000
3+++ plugins/Dash/listviewwithpageheader.cpp 2016-10-06 10:54:33 +0000
4@@ -772,7 +772,7 @@
5 delete nobj;
6 } else {
7 sectionItem->setProperty("text", sectionText);
8- sectionItem->setProperty("delegateIndex", -1);
9+ sectionItem->setProperty("delegate", QVariant());
10 sectionItem->setZ(2);
11 QQml_setParent_noEvent(sectionItem, m_clipItem);
12 sectionItem->setParentItem(m_clipItem);
13@@ -929,7 +929,7 @@
14 polish();
15 }
16 if (listItem->sectionItem()) {
17- listItem->sectionItem()->setProperty("delegateIndex", modelIndex);
18+ listItem->sectionItem()->setProperty("delegate", QVariant::fromValue(listItem->m_item));
19 }
20 adjustMinYExtent();
21 m_contentHeightDirty = true;
22@@ -1123,7 +1123,7 @@
23 for (int i = 0; i < m_visibleItems.count(); ++i) {
24 ListItem *item = m_visibleItems[i];
25 if (item->sectionItem()) {
26- item->sectionItem()->setProperty("delegateIndex", m_firstVisibleIndex + i);
27+ item->sectionItem()->setProperty("delegate", QVariant::fromValue(item->m_item));
28 }
29 }
30
31@@ -1297,15 +1297,7 @@
32
33 QQuickItemPrivate::get(m_topSectionItem)->setCulled(false);
34 m_topSectionItem->setY(topSectionStickPos);
35- int delegateIndex = modelIndex;
36- // Look for the first index with this section text
37- while (delegateIndex > 0) {
38- const QString prevSection = m_delegateModel->stringValue(delegateIndex - 1, m_sectionProperty);
39- if (prevSection != section)
40- break;
41- delegateIndex--;
42- }
43- m_topSectionItem->setProperty("delegateIndex", delegateIndex);
44+ m_topSectionItem->setProperty("delegate", QVariant::fromValue(item->m_item));
45 if (item->sectionItem()) {
46 QQuickItemPrivate::get(item->sectionItem())->setCulled(true);
47 }
48
49=== modified file 'qml/Dash/GenericScopeView.qml'
50--- qml/Dash/GenericScopeView.qml 2016-09-22 07:37:21 +0000
51+++ qml/Dash/GenericScopeView.qml 2016-10-06 10:54:33 +0000
52@@ -623,8 +623,7 @@
53 sectionProperty: "name"
54 sectionDelegate: ListItems.Header {
55 objectName: "dashSectionHeader" + (delegate ? delegate.category : "")
56- property int delegateIndex: -1
57- readonly property var delegate: categoryView.item(delegateIndex)
58+ property var delegate: null
59 width: categoryView.width
60 height: text != "" ? units.gu(5) : 0
61 color: scopeStyle ? scopeStyle.foreground : theme.palette.normal.baseText
62
63=== modified file 'tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp'
64--- tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp 2016-06-27 18:44:41 +0000
65+++ tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp 2016-10-06 10:54:33 +0000
66@@ -82,7 +82,7 @@
67 QCOMPARE(section(lvwph->m_visibleItems[visibleIndex]->sectionItem()), sectionHeader);
68 if (!sectionHeader.isNull()) {
69 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->sectionItem())->culled, sectionHeaderCulled);
70- QCOMPARE(sectionDelegateIndex(lvwph->m_visibleItems[visibleIndex]->sectionItem()), lvwph->m_firstVisibleIndex + visibleIndex);
71+ QCOMPARE(sectionDelegate(lvwph->m_visibleItems[visibleIndex]->sectionItem()), lvwph->m_visibleItems[visibleIndex]->m_item);
72 }
73 }
74
75@@ -151,9 +151,9 @@
76 return item ? item->property("text").toString() : QString();
77 }
78
79- int sectionDelegateIndex(QQuickItem *item)
80+ QQuickItem *sectionDelegate(QQuickItem *item)
81 {
82- return item ? item->property("delegateIndex").toInt() : -1;
83+ return item ? item->property("delegate").value<QQuickItem *>() : nullptr;
84 }
85
86 private Q_SLOTS:
87
88=== modified file 'tests/plugins/Dash/listviewwithpageheadersectiontest.cpp'
89--- tests/plugins/Dash/listviewwithpageheadersectiontest.cpp 2016-06-27 18:44:41 +0000
90+++ tests/plugins/Dash/listviewwithpageheadersectiontest.cpp 2016-10-06 10:54:33 +0000
91@@ -39,7 +39,7 @@
92 QCOMPARE(section(lvwph->m_visibleItems[visibleIndex]->sectionItem()), sectionHeader);
93 if (!sectionHeader.isNull()) {
94 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->sectionItem())->culled, sectionHeaderCulled);
95- QCOMPARE(sectionDelegateIndex(lvwph->m_visibleItems[visibleIndex]->sectionItem()), lvwph->m_firstVisibleIndex + visibleIndex);
96+ QCOMPARE(sectionDelegate(lvwph->m_visibleItems[visibleIndex]->sectionItem()), lvwph->m_visibleItems[visibleIndex]->m_item);
97 }
98 }
99
100@@ -116,9 +116,9 @@
101 return item ? item->property("text").toString() : QString();
102 }
103
104- int sectionDelegateIndex(QQuickItem *item) const
105+ QQuickItem *sectionDelegate(QQuickItem *item) const
106 {
107- return item ? item->property("delegateIndex").toInt() : -1;
108+ return item ? item->property("delegate").value<QQuickItem *>() : nullptr;
109 }
110
111 private Q_SLOTS:
112@@ -220,7 +220,7 @@
113 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
114 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
115 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
116- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
117+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
118 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
119 }
120
121@@ -242,7 +242,7 @@
122 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
123 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
124 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
125- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
126+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
127 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
128 }
129
130@@ -264,7 +264,7 @@
131 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
132 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
133 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
134- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
135+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
136 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
137
138 changeContentY(-30);
139@@ -283,7 +283,7 @@
140 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
141 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
142 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
143- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
144+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
145 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
146 }
147
148@@ -339,7 +339,7 @@
149 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
150 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
151 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
152- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
153+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
154 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
155
156 lvwph->positionAtBeginning();
157@@ -365,7 +365,7 @@
158 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
159 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
160 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
161- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
162+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
163 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
164
165 lvwph->positionAtBeginning();
166@@ -410,7 +410,7 @@
167 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
168 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
169 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
170- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
171+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
172 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
173
174 model->setProperty(0, "size", 400);
175@@ -430,7 +430,7 @@
176 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
177 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
178 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
179- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
180+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
181 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
182
183 scrollToTop();
184@@ -484,7 +484,7 @@
185 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
186 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
187 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
188- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
189+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
190 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
191
192 model->setProperty(0, "size", 400);
193@@ -504,7 +504,7 @@
194 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
195 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
196 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
197- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
198+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
199 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
200
201 scrollToTop();
202@@ -541,7 +541,7 @@
203 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
204 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
205 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
206- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
207+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
208 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
209
210 changeContentY(-30);
211@@ -559,7 +559,7 @@
212 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
213 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
214 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
215- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
216+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
217 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
218
219 changeContentY(30);
220@@ -577,7 +577,7 @@
221 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
222 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
223 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
224- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
225+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
226 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
227
228 changeContentY(-30);
229@@ -595,7 +595,7 @@
230 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
231 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
232 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
233- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
234+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
235 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
236 }
237
238@@ -616,7 +616,7 @@
239 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
240 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
241 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
242- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
243+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
244 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
245
246 lvwph->setDelegate(otherDelegate);
247@@ -675,7 +675,7 @@
248 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
249 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
250 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
251- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
252+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
253 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
254
255 scrollToTop();
256@@ -714,7 +714,7 @@
257 QTRY_VERIFY(lvwph->isAtYEnd());
258 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
259 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
260- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
261+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
262 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
263
264 scrollToTop();
265@@ -751,7 +751,7 @@
266 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
267 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
268 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
269- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
270+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
271 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
272 }
273
274@@ -836,7 +836,7 @@
275 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
276 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
277 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
278- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
279+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
280 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
281
282 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
283@@ -857,7 +857,7 @@
284 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
285 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
286 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
287- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 4);
288+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
289 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
290
291 scrollToTop();
292@@ -898,7 +898,7 @@
293 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
294 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
295 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
296- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
297+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
298 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
299
300 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 3), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
301@@ -919,7 +919,7 @@
302 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
303 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
304 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
305- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
306+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
307 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
308 }
309
310@@ -942,7 +942,7 @@
311 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
312 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
313 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
314- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
315+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
316 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
317
318 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
319@@ -963,7 +963,7 @@
320 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
321 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
322 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
323- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 4);
324+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
325 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
326 }
327
328@@ -986,7 +986,7 @@
329 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
330 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
331 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
332- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
333+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
334 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
335
336 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
337@@ -1007,7 +1007,7 @@
338 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
339 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
340 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
341- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
342+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
343 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
344
345 scrollToTop();
346@@ -1055,7 +1055,7 @@
347 QVERIFY(!lvwph->isAtYEnd());
348 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
349 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
350- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
351+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
352 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
353
354 scrollToBottom();
355@@ -1076,7 +1076,7 @@
356 QVERIFY(lvwph->isAtYEnd());
357 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
358 QCOMPARE(section(lvwph->m_topSectionItem), QString("Lazy"));
359- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 5);
360+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
361 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
362 }
363
364@@ -1130,7 +1130,7 @@
365 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
366 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
367 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
368- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 13);
369+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
370 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
371
372 changeContentY(-1700);
373@@ -1155,7 +1155,7 @@
374 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
375 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
376 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
377- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 4);
378+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[3]->m_item);
379 QCOMPARE(lvwph->m_topSectionItem->y(), -23.);
380 }
381
382@@ -1217,7 +1217,7 @@
383 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
384 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
385 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
386- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
387+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
388 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
389 }
390
391@@ -1241,7 +1241,7 @@
392 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
393 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
394 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
395- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
396+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
397 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
398 }
399
400@@ -1264,7 +1264,7 @@
401 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
402 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
403 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
404- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
405+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
406 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
407
408 QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 1), Q_ARG(QVariant, 1));
409@@ -1284,7 +1284,7 @@
410 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
411 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
412 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
413- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
414+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
415 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
416 }
417
418@@ -1307,7 +1307,7 @@
419 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
420 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
421 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
422- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
423+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
424 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
425
426 QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 3), Q_ARG(QVariant, 1));
427@@ -1327,7 +1327,7 @@
428 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
429 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
430 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
431- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
432+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
433 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
434 }
435
436@@ -1407,7 +1407,7 @@
437 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
438 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
439 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
440- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
441+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
442 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
443
444 QMetaObject::invokeMethod(model, "moveItems", Q_ARG(QVariant, 0), Q_ARG(QVariant, 5), Q_ARG(QVariant, 1));
445@@ -1428,7 +1428,7 @@
446 QVERIFY(!lvwph->isAtYEnd());
447 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
448 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
449- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
450+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
451 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
452 }
453
454@@ -1452,7 +1452,7 @@
455 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
456 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
457 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
458- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
459+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[2]->m_item);
460 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
461
462 model->setProperty(1, "size", 100);
463@@ -1473,7 +1473,7 @@
464 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
465 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
466 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
467- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
468+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[2]->m_item);
469 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
470 }
471
472@@ -1512,7 +1512,7 @@
473 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
474 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
475 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
476- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
477+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
478 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
479
480 scrollToTop();
481@@ -1551,7 +1551,7 @@
482 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
483 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
484 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
485- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
486+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
487 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
488
489 lvwph->showHeader();
490@@ -1572,7 +1572,7 @@
491 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
492 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
493 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
494- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
495+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
496 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
497
498 scrollToTop();
499@@ -1759,7 +1759,7 @@
500 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
501 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
502 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
503- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
504+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
505 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
506 }
507
508@@ -1784,7 +1784,7 @@
509 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
510 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
511 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
512- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
513+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
514 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
515 }
516
517@@ -1892,7 +1892,7 @@
518 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
519 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
520 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
521- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
522+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
523 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
524 }
525
526@@ -1914,7 +1914,7 @@
527 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
528 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
529 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
530- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
531+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
532 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
533
534 bool res = lvwph->maximizeVisibleArea(1);
535@@ -1934,7 +1934,7 @@
536 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
537 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
538 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
539- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
540+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
541 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
542 }
543
544@@ -1987,7 +1987,7 @@
545 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
546 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
547 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
548- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
549+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[1]->m_item);
550 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
551 }
552
553@@ -2014,7 +2014,7 @@
554 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
555 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
556 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
557- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
558+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
559 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
560
561 changeContentY(20);
562@@ -2037,7 +2037,7 @@
563 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
564 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
565 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
566- QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
567+ QCOMPARE(sectionDelegate(lvwph->m_topSectionItem), lvwph->m_visibleItems[0]->m_item);
568 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
569 }
570

Subscribers

People subscribed via source and target branches