on xenial help sign in
Add widgetData["expanded"] property for expandable widget.

Define widgetData["expanded"] for expandable widget to make it possible to set Expandablewidget expanded property when it's initialized. The expandable widget is unexpanded by default.

commitbfe824ebacd5ef81ca09c7df53318237d6edca10 authorGary.Wzl <Gary.Wang@canonical.com> dateMon 3 Aug 2015, 21:31 (11 years ago) parent6f3298a
2 files changed+7−3
qml/Dash/Previews/PreviewExpandable.qml+4−2 qml/Dash/Previews/PreviewWidgetFactory.qml+3−1
qml/Dash/Previews/PreviewExpandable.qml+4−2
@@ -24,14 +24,16 @@ import "../../Components"
2424 Those widgets can be collapsed or uncollapsed. When uncollapsed
2525 all the widgets are shown, when collapsed only the first
2626 widgetData["collapsed-widgets"] are shown. It has a title that comes
27− in via widgetData["title"]
27+ in via widgetData["title"]. This widget expands all child widgets
28+ when construction by specifying widgetData["expanded"] == true.
29+ It's in unexpanded mode by default.
2830 */
2931
3032PreviewWidget {
3133 id: root
3234 implicitHeight: childrenRect.height
3335
34− expanded: false
36+ expanded: widgetData["expanded"] == undefined? false : widgetData["expanded"];
3537
3638 Label {
3739 id: titleLabel
qml/Dash/Previews/PreviewWidgetFactory.qml+3−1
@@ -74,8 +74,10 @@ Loader {
7474 item.widgetId = Qt.binding(function() { return root.widgetId } )
7575 item.widgetData = Qt.binding(function() { return root.widgetData } )
7676 item.isCurrentPreview = Qt.binding(function() { return root.isCurrentPreview } )
77− item.expanded = Qt.binding(function() { return root.expanded } )
7877 item.scopeStyle = Qt.binding(function() { return root.scopeStyle } )
78+
79+ if (widgetType !== "expandable")
80+ item.expanded = Qt.binding(function() { return root.expanded } )
7981 }
8082
8183 Connections {