2 * Copyright (C) 2014 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 //! \brief This component loads the widgets based on type.
24 //! The ScopeStyle component.
25 property var scopeStyle: null
27 //! Variable used to contain widget's data
28 property var widgetData: null
30 //! Triggered signal forwarded from the widgets.
31 signal updated(var value)
33 //! makeSureVisible signal forwarded from the widgets.
34 signal makeSureVisible(var item)
39 property url widgetSource: {
40 switch (widgetData.type) {
41 case "boolean": return "ScopeSettingBoolean.qml";
42 case "list": return "ScopeSettingList.qml";
43 case "number": return "ScopeSettingNumber.qml";
44 case "string": return "ScopeSettingString.qml";
51 if (item.hasOwnProperty("initialValue")) item.initialValue = root.widgetData.value;
52 item.widgetData = Qt.binding(function() { return root.widgetData; } )
53 item.scopeStyle = Qt.binding(function() { return root.scopeStyle; } )
58 onUpdated: if (value !== widgetData.value) root.updated(value)
59 onMakeSureVisible: root.makeSureVisible(item)