Debian Codegraph @

qml/components/OptionButton.qml

raw
1 /*
2 * Copyright 2014 Canonical Ltd.
3 *
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.
7 *
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.
12 *
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/>.
15 */
16
17 import QtQuick 2.12
18
19 CircleButton {
20 id: optionButton
21 objectName: "optionButton"
22
23 property var model
24 property string settingsProperty: model.settingsProperty !== undefined ? model.settingsProperty : ""
25
26 iconName: (!model.get(model.selectedIndex) || !model.get(model.selectedIndex).icon) ?
27 (model.icon ? model.icon : "") :
28 model.get(model.selectedIndex).icon
29 iconSource: (!model.get(model.selectedIndex) || !model.get(model.selectedIndex).iconSource) ?
30 ((model && model.iconSource) ? model.iconSource : "") :
31 model.get(model.selectedIndex).iconSource
32
33 on: model.isToggle ? model.get(model.selectedIndex).value : true
34 enabled: model.visible && model.available
35 label: model.label
36 visible: model.visible && model.available
37 automaticOrientation: false
38 }