on xenial help sign in
Call updateDelegateCreationRange when it's needed

It depends on other variables than the ones we were using to call it, so need to call it if these change too Device manual test, go to apps scope, scroll down so that only part of the installed apps collapsed category is shown, expand it, see how previously some icons were not painted and now they are

commit0c88c2fb4a9777710ab889b51bdfef325615c371 authorAlbert Astals <albert.astals@canonical.com> dateTue 28 Jan 2014, 11:08 (13 years ago) parenteba4742
2 files changed+29−2
qml/Dash/GenericScopeView.qml+7−1 tests/qmltests/Dash/tst_GenericScopeView.qml+22−1
qml/Dash/GenericScopeView.qml+7−1
@@ -141,6 +141,7 @@ FocusScope {
141141 readonly property bool expandable: rendererLoader.item ? rendererLoader.item.expandable : false
142142 readonly property bool filtered: rendererLoader.item ? rendererLoader.item.filter : true
143143 readonly property string category: categoryId
144+ readonly property var item: rendererLoader.item
144145
145146 Loader {
146147 id: rendererLoader
@@ -248,8 +249,10 @@ FocusScope {
248249 }
249250 }
250251 }
252+ onOriginYChanged: rendererLoader.updateDelegateCreationRange();
251253 onContentYChanged: rendererLoader.updateDelegateCreationRange();
252254 onHeightChanged: rendererLoader.updateDelegateCreationRange();
255+ onContentHeightChanged: rendererLoader.updateDelegateCreationRange();
253256 }
254257
255258 function updateDelegateCreationRange() {
@@ -261,7 +264,7 @@ FocusScope {
261264 return;
262265 }
263266
264− if (item.hasOwnProperty("delegateCreationBegin")) {
267+ if (item && item.hasOwnProperty("delegateCreationBegin")) {
265268 if (baseItem.y + baseItem.height <= 0) {
266269 // Not visible (item at top of the list)
267270 item.delegateCreationBegin = baseItem.height
@@ -277,6 +280,9 @@ FocusScope {
277280 }
278281 }
279282 }
283+
284+ onHeightChanged: rendererLoader.updateDelegateCreationRange();
285+ onYChanged: rendererLoader.updateDelegateCreationRange();
280286 }
281287
282288 sectionProperty: "name"
tests/qmltests/Dash/tst_GenericScopeView.qml+22−1
@@ -71,7 +71,13 @@ Item {
7171 name: "GenericScopeView"
7272 when: scopes.loaded
7373
74− function test_isCurrent() {
74+ function init() {
75+ shell.width = units.gu(120)
76+ genericScopeView.categoryView.positionAtBeginning();
77+ tryCompare(genericScopeView.categoryView.contentY, 0)
78+ }
79+
80+ function test_isCurrent() {
7581 genericScopeView.isCurrent = true
7682 pageHeader.searchQuery = "test"
7783 previewListView.open = true
@@ -336,6 +342,21 @@ Item {
336342 tryCompare(category2, "filtered", true);
337343 tryCompare(category2FilterGrid, "filter", true);
338344 }
345+
346+ function test_narrow_delegate_ranges_expand() {
347+ tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory0") != undefined; }, true);
348+ var category = findChild(genericScopeView, "dashCategory0")
349+
350+ shell.width = units.gu(20)
351+ var categoryListView = findChild(genericScopeView, "categoryListView");
352+ categoryListView.contentY = units.gu(20);
353+ var header0 = findChild(genericScopeView, "dashSectionHeader0")
354+ mouseClick(header0, header0.width / 2, header0.height / 2);
355+ tryCompare(category, "filtered", false);
356+ tryCompare(category.item, "delegateCreationEnd", category.item.delegateCreationBegin + genericScopeView.height);
357+ mouseClick(header0, header0.width / 2, header0.height / 2);
358+ tryCompare(category, "filtered", true);
359+ }
339360 }
340361 }
341362}