on xenial help sign in
Type and id are not available in widgetData, only as roles from the model.
67cc46dMichał Sawicz
qml/Dash/Previews/PreviewWidgetFactory.qml+14−6
@@ -24,14 +24,23 @@ import Unity 0.1
24Loader {
24Loader {
25 id: root
25 id: root
26
26
27+ //! Identifier of the widget.
28+ property string widgetId: ""
29+
30+ //! Type of the widget to display.
31+ property string widgetType: ""
32+
27 //! Widget data, forwarded to the widget as is.
33 //! Widget data, forwarded to the widget as is.
28 property var widgetData: null
34 property var widgetData: null
29
35
36+ //! Set to true if the parent preview is displayed.
37+ property bool isCurrentPreview: false
38+
30 //! Triggered signal forwarded from the widgets.
39 //! Triggered signal forwarded from the widgets.
31 signal triggered(string widgetId, string actionId, var data)
40 signal triggered(string widgetId, string actionId, var data)
32
41
33 source: {
42 source: {
34− switch (widgetData && widgetData["type"]) {
43+ switch (type) {
35 case "audio": return "PreviewAudioPlayback.qml";
44 case "audio": return "PreviewAudioPlayback.qml";
36 case "text": return "PreviewTextSummary.qml";
45 case "text": return "PreviewTextSummary.qml";
37 case "gallery": return "PreviewImageGallery.qml";
46 case "gallery": return "PreviewImageGallery.qml";
@@ -40,11 +49,10 @@ Loader {
40 }
49 }
41 }
50 }
42
51
43− Binding {
52+ onLoaded: {
44− target: root.item
53+ item.widgetId = Qt.binding(function() { return root.widgetId } )
45− when: root.status === Loader.Ready
54+ item.widgetData = Qt.binding(function() { return root.widgetData } )
46− property: "widgetData"
55+ item.isCurrentPreview = Qt.binding(function() { return root.isCurrentPreview } )
47− value: root.widgetData
48 }
56 }
49
57
50 Connections {
58 Connections {