on xenial help sign in
Merge lp:~aacid/unity8/new-scopes-preview-sometimes-disappears
1a212a6Albert Astals
qml/Dash/PreviewListView.qml+18−6
@@ -21,6 +21,8 @@ import "../Components"
21import "Previews" as Previews
21import "Previews" as Previews
22
22
23Item {
23Item {
24+ id: root
25+
24 property OpenEffect openEffect: null
26 property OpenEffect openEffect: null
25 property ScopeListView categoryView: null
27 property ScopeListView categoryView: null
26 property Scope scope: null
28 property Scope scope: null
@@ -98,12 +100,6 @@ Item {
98
100
99 categoryDelegate.highlightIndex = currentIndex
101 categoryDelegate.highlightIndex = currentIndex
100
102
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−
107 // Adjust contentY in case we need to change to it to show the next row
103 // Adjust contentY in case we need to change to it to show the next row
108 if (categoryDelegate.rows > 1) {
104 if (categoryDelegate.rows > 1) {
109 var itemY = categoryView.contentItem.mapFromItem(categoryDelegate.currentItem).y;
105 var itemY = categoryView.contentItem.mapFromItem(categoryDelegate.currentItem).y;
@@ -167,6 +163,22 @@ Item {
167
163
168 onPreviewModelChanged: preview.opacity = 0;
164 onPreviewModelChanged: preview.opacity = 0;
169 onReadyChanged: if (ready) fadeIn.start()
165 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+
170// onClose: {
182// onClose: {
171// previewListView.open = false
183// previewListView.open = false
172// }
184// }