on xenial help sign in
PreviewExpandable: "widgets" is a model, not an array
063aa87Albert Astals
qml/Dash/Previews/PreviewExpandable.qml+3−3
@@ -80,9 +80,9 @@ PreviewWidget {
80 delegate: PreviewWidgetFactory {
80 delegate: PreviewWidgetFactory {
81 height: visible ? implicitHeight : 0
81 height: visible ? implicitHeight : 0
82 width: parent.width
82 width: parent.width
83− widgetId: modelData.widgetId
83+ widgetId: model.widgetId
84− widgetType: modelData.type
84+ widgetType: model.type
85− widgetData: modelData.properties
85+ widgetData: model.properties
86 isCurrentPreview: root.isCurrentPreview
86 isCurrentPreview: root.isCurrentPreview
87 scopeStyle: root.scopeStyle
87 scopeStyle: root.scopeStyle
88 anchors {
88 anchors {
tests/qmltests/Dash/Previews/tst_PreviewExpandable.qml+12−6
@@ -30,15 +30,21 @@ Rectangle {
30 property string longText2: "This is a very very very long text. 1 This is a very very very long text. 2 This is a very very very long text. 3 This is a very very very long text. 4 This is a very very very long text. 5 This is a very very very long text. 6 This is a very very very long text. 7 This is a very very very long text. 8 This is a very very very long text. 9 This is a very very very long text. 10 This is a very very very long text. 11 This is a very very very long text."
30 property string longText2: "This is a very very very long text. 1 This is a very very very long text. 2 This is a very very very long text. 3 This is a very very very long text. 4 This is a very very very long text. 5 This is a very very very long text. 6 This is a very very very long text. 7 This is a very very very long text. 8 This is a very very very long text. 9 This is a very very very long text. 10 This is a very very very long text. 11 This is a very very very long text."
31 property string shortText: "This is a short text :)"
31 property string shortText: "This is a short text :)"
32
32
33+ ListModel {
34+ id: widgetsModel
35+ }
36+
33 property var widgetData: {
37 property var widgetData: {
34 "title": "Title here",
38 "title": "Title here",
35 "collapsed-widgets": 2,
39 "collapsed-widgets": 2,
36− "widgets": [
40+ "widgets": widgetsModel
41+ }
42+
43+ Component.onCompleted: {
37− { "type": "text", "widgetId" : "text1", "properties" : { "text": longText } },
44+ widgetsModel.append({"type": "text", "widgetId": "text1", "properties": { "text": longText }});
38− { "type": "text", "widgetId" : "text2", "properties" : { "text": longText2 } },
45+ widgetsModel.append({"type": "text", "widgetId": "text2", "properties": { "text": longText2 }});
39− { "type": "text", "widgetId" : "text3", "properties" : { "text": shortText } },
46+ widgetsModel.append({"type": "text", "widgetId": "text3", "properties": { "text": shortText }});
40− { "type": "text", "widgetId" : "text4", "properties" : { "text": longText } }
47+ widgetsModel.append({"type": "text", "widgetId": "text4", "properties": { "text": longText }});
41− ]
42 }
48 }
43
49
44 PreviewExpandable {
50 PreviewExpandable {