on xenial help sign in
Fix preview disappearing sometimes
9b80cc8Albert Astals
qml/Dash/PreviewListView.qml+12−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,16 @@ 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+ if (isCurrent) {
168+ var previewStack = root.scope.preview(result);
169+ return previewStack.get(0);
170+ } else {
171+ ready = false;
172+ return null;
173+ }
174+ }
175+
170// onClose: {
176// onClose: {
171// previewListView.open = false
177// previewListView.open = false
172// }
178// }