Debian Codegraph @

qml/Components/ChooserLength.qml

raw
1 /*
2 * This file is based on work taken from Ubuntu Weather app as on September 2019. Copyright (C) 2019 UBports
3 * Copyright (C) 2019 Joan Cibersheep
4 *
5 *
6 * This App is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 3 as
8 * published by the Free Software Foundation.
9 *
10 *
11 * This App is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 import QtQuick 2.9
22 import Lomiri.Components 1.3
23
24 Item {
25 height: lengSetting.height
26
27 property string selectedLeng: "6"
28
29 ListModel {
30 id: lengModel
31 Component.onCompleted: initialize()
32
33 function initialize() {
34 lengModel.append({"text": "6"})
35 lengModel.append({"text": "7"})
36 lengModel.append({"text": "8"})
37 lengModel.append({"text": "9"})
38 }
39 }
40
41 ExpandableListItem {
42 id: lengSetting
43 listViewHeight: lengModel.count*units.gu(6.1)
44 model: lengModel
45 title.text: selectedLeng
46
47 delegate: StandardListItem {
48 title.text: model.text
49 icon.name: "ok"
50 icon.visible: selectedLeng === model.text
51
52 onClicked: {
53 selectedLeng = model.text;
54 lengSetting.toggleExpansion();
55 }
56 }
57 }
58 }