on xenial help sign in
Previews.Preview delegate needs to query for a new preview on each invocation of previewModel
f0e82f7Marcus Tomlinson
qml/Dash/GenericScopeView.qml+5−10
@@ -66,25 +66,23 @@ FocusScope {
66 // so it's not implemented
66 // so it's not implemented
67 scope.activate(result)
67 scope.activate(result)
68 } else {
68 } else {
69− var previewStack = scope.preview(result);
69+ if (scope.preview(result))
70− if (previewStack)
71 {
70 {
72− openPreview(index, resultsModel, limitedCategoryItemCount, previewStack);
71+ openPreview(index, resultsModel, limitedCategoryItemCount);
73 }
72 }
74 }
73 }
75 }
74 }
76
75
77 function itemPressedAndHeld(index, result, itemModel, resultsModel, limitedCategoryItemCount) {
76 function itemPressedAndHeld(index, result, itemModel, resultsModel, limitedCategoryItemCount) {
78 if (itemModel.uri.indexOf("scope://") !== 0) {
77 if (itemModel.uri.indexOf("scope://") !== 0) {
79− var previewStack = scope.preview(result);
78+ if (scope.preview(result))
80− if (previewStack)
81 {
79 {
82− openPreview(index, resultsModel, limitedCategoryItemCount, previewStack);
80+ openPreview(index, resultsModel, limitedCategoryItemCount);
83 }
81 }
84 }
82 }
85 }
83 }
86
84
87− function openPreview(index, resultsModel, limitedCategoryItemCount, previewStack) {
85+ function openPreview(index, resultsModel, limitedCategoryItemCount) {
88 if (limitedCategoryItemCount > 0) {
86 if (limitedCategoryItemCount > 0) {
89 previewLimitModel.model = resultsModel;
87 previewLimitModel.model = resultsModel;
90 previewLimitModel.limit = limitedCategoryItemCount;
88 previewLimitModel.limit = limitedCategoryItemCount;
@@ -94,7 +92,6 @@ FocusScope {
94 }
92 }
95 subPageLoader.initialIndex = -1;
93 subPageLoader.initialIndex = -1;
96 subPageLoader.initialIndex = index;
94 subPageLoader.initialIndex = index;
97− subPageLoader.previewModel = previewStack.getPreviewModel(0);
98 subPageLoader.openSubPage("preview");
95 subPageLoader.openSubPage("preview");
99 }
96 }
100
97
@@ -527,7 +524,6 @@ FocusScope {
527 property var scopeStyle: scopeView.scopeStyle
524 property var scopeStyle: scopeView.scopeStyle
528 property int initialIndex: -1
525 property int initialIndex: -1
529 property var model: null
526 property var model: null
530− property var previewModel: null
531
527
532 readonly property bool processing: item && item.processing || false
528 readonly property bool processing: item && item.processing || false
533 readonly property int count: item && item.count || 0
529 readonly property int count: item && item.count || 0
@@ -558,7 +554,6 @@ FocusScope {
558 item.open = Qt.binding(function() { return subPageLoader.open; } )
554 item.open = Qt.binding(function() { return subPageLoader.open; } )
559 item.initialIndex = Qt.binding(function() { return subPageLoader.initialIndex; } )
555 item.initialIndex = Qt.binding(function() { return subPageLoader.initialIndex; } )
560 item.model = Qt.binding(function() { return subPageLoader.model; } )
556 item.model = Qt.binding(function() { return subPageLoader.model; } )
561− item.previewModel = Qt.binding(function() { return subPageLoader.previewModel; } )
562 }
557 }
563 open = true;
558 open = true;
564 }
559 }
qml/Dash/PreviewListView.qml+4−2
@@ -26,7 +26,6 @@ Item {
26 property int initialIndex: -1
26 property int initialIndex: -1
27 property var scope: null
27 property var scope: null
28 property var scopeStyle: null
28 property var scopeStyle: null
29− property var previewModel: null
30
29
31 property alias showSignatureLine: header.showSignatureLine
30 property alias showSignatureLine: header.showSignatureLine
32
31
@@ -99,7 +98,10 @@ Item {
99
98
100 isCurrent: ListView.isCurrentItem
99 isCurrent: ListView.isCurrentItem
101
100
102− previewModel: root.previewModel
101+ previewModel: {
102+ var previewStack = root.scope.preview(result);
103+ return previewStack.getPreviewModel(0);
104+ }
103 scopeStyle: root.scopeStyle
105 scopeStyle: root.scopeStyle
104 }
106 }
105 }
107 }