on xenial help sign in
Merge lp:~aacid/unity8/new-scopes-preview-sometimes-disappears
commit1a212a67c6892bfa9542f510f5bfb2ef09900375 authorAlbert Astals <albert.astals@canonical.com> dateThu 13 Feb 2014, 17:18 (13 years ago) parent5cb5e70820c9a5
1 file changed+18−6
qml/Dash/PreviewListView.qml+18−6
qml/Dash/PreviewListView.qml+18−6
@@ -21,6 +21,8 @@ import "../Components"
2121import "Previews" as Previews
2222
2323Item {
24+ id: root
25+
2426 property OpenEffect openEffect: null
2527 property ScopeListView categoryView: null
2628 property Scope scope: null
@@ -98,12 +100,6 @@ Item {
98100
99101 categoryDelegate.highlightIndex = currentIndex
100102
101− if (model !== undefined) {
102− var item = model.get(currentIndex)
103− var previewStack = scope.preview(item.result)
104− previewListView.currentItem.previewModel = previewStack.get(0)
105− }
106−
107103 // Adjust contentY in case we need to change to it to show the next row
108104 if (categoryDelegate.rows > 1) {
109105 var itemY = categoryView.contentItem.mapFromItem(categoryDelegate.currentItem).y;
@@ -167,6 +163,22 @@ Item {
167163
168164 onPreviewModelChanged: preview.opacity = 0;
169165 onReadyChanged: if (ready) fadeIn.start()
166+ previewModel: {
167+ // TODO
168+ // We need the isCurrent because the scope fails to
169+ // deliver the preview if we ask for one after other very quickly
170+ // If we remove the isCurrent, we will have to think another way of
171+ // doing the fadeIn or just don't do it at all or just decide
172+ // this code is good enough and remove the TODO
173+ if (isCurrent) {
174+ var previewStack = root.scope.preview(result);
175+ return previewStack.get(0);
176+ } else {
177+ ready = false;
178+ return null;
179+ }
180+ }
181+
170182// onClose: {
171183// previewListView.open = false
172184// }