@@ -72,6 +72,7 @@ ScopeView {
7272 property string expandedCategoryId: ""
7373
7474 delegate: ListItems.Base {
75+ id: baseItem
7576 highlightWhenPressed: false
7677
7778 readonly property bool expandable: rendererLoader.item ? rendererLoader.item.expandable : false
@@ -108,6 +109,7 @@ ScopeView {
108109 item.filter = shouldFilter;
109110 }
110111 }
112+ updateDelegateCreationRange();
111113 }
112114
113115 Component.onDestruction: {
@@ -164,6 +166,33 @@ ScopeView {
164166 }
165167 }
166168 }
169+ onContentYChanged: rendererLoader.updateDelegateCreationRange();
170+ onHeightChanged: rendererLoader.updateDelegateCreationRange();
171+ }
172+
173+ function updateDelegateCreationRange() {
174+ // Do not update the range if we are overshooting up or down, since we'll come back
175+ // to the stable position and delete/create items without any reason
176+ if (categoryView.contentY < categoryView.originY) {
177+ return;
178+ } else if (categoryView.contentY + categoryView.height > categoryView.contentHeight) {
179+ return;
180+ }
181+
182+ if (item.hasOwnProperty("delegateCreationBegin")) {
183+ if (baseItem.y + baseItem.height <= 0) {
184+ // Not visible (item at top of the list)
185+ item.delegateCreationBegin = baseItem.height
186+ item.delegateCreationEnd = baseItem.height
187+ } else if (baseItem.y >= categoryView.height) {
188+ // Not visible (item at bottom of the list)
189+ item.delegateCreationBegin = 0
190+ item.delegateCreationEnd = 0
191+ } else {
192+ item.delegateCreationBegin = Math.max(-baseItem.y, 0)
193+ item.delegateCreationEnd = Math.min(categoryView.height + item.delegateCreationBegin, baseItem.height)
194+ }
195+ }
167196 }
168197 }
169198 }