@@ -15,13 +15,13 @@
1515 */
1616
1717import QtQuick 2.4
18+import Ubuntu.Components 1.3
1819import Unity 0.2
1920
2021//! \brief This component loads the widgets based on widgetType.
2122
22−Loader {
23+Item {
2324 id: root
24−
2525 //! Identifier of the widget.
2626 property string widgetId: ""
2727
@@ -31,20 +31,48 @@ Loader {
3131 //! Widget data, forwarded to the widget as is.
3232 property var widgetData: null
3333
34− source: widgetSource
34+ implicitHeight: childrenRect.height + title.anchors.topMargin
35+
36+ Label {
37+ id: title
38+ text: widgetData ? widgetData.title : ""
39+ height: text != "" ? implicitHeight : 0
40+
41+ anchors {
42+ top: parent.top
43+ left: parent.left
44+ right: parent.right
3545
36− //! \cond private
37− readonly property url widgetSource: {
38− switch (widgetType) {
39− case Filters.OptionSelectorFilter: return "FilterOptionSelector.qml";
40− case Filters.RangeInputFilter: return "FilterRangeInput.qml";
41− default: return "";
46+ topMargin: height > 0 ? units.gu(1) : 0
47+ leftMargin: units.gu(2)
48+ rightMargin: anchors.leftMargin
4249 }
4350 }
44− //! \endcond
4551
46− onLoaded: {
47− item.widgetId = Qt.binding(function() { return root.widgetId } )
48− item.widgetData = Qt.binding(function() { return root.widgetData } )
52+ property alias active: loader.active
53+
54+ Loader {
55+ id: loader
56+
57+ anchors {
58+ top: title.bottom
59+ left: parent.left
60+ right: parent.right
61+ }
62+
63+ source: widgetSource
64+
65+ readonly property url widgetSource: {
66+ switch (widgetType) {
67+ case Filters.OptionSelectorFilter: return "FilterOptionSelector.qml";
68+ case Filters.RangeInputFilter: return "FilterRangeInput.qml";
69+ default: return "";
70+ }
71+ }
72+
73+ onLoaded: {
74+ item.widgetId = Qt.binding(function() { return root.widgetId } )
75+ item.widgetData = Qt.binding(function() { return root.widgetData } )
76+ }
4977 }
5078}