1/**
2 * \file Standard.qml
3 * Standard list item.
4 *
5 * \b Project: Kid3
6 * \author Urs Fleisch
7 * \date 16 Feb 2015
8 *
9 * Copyright (C) 2015-2018  Urs Fleisch
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; version 3.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 */
23
24import QtQuick 2.11
25import QtQuick.Controls 2.4
26
27ItemDelegate {
28  id: listItem
29  property bool progression
30  property alias control: controlContainer.control
31
32  width: parent ? parent.width : constants.gu(31)
33  height: constants.rowHeight
34
35  contentItem: Item {
36    anchors.fill: parent
37
38    Text {
39      id: textLabel
40      anchors.left: parent.left
41      anchors.right: controlContainer.left
42      anchors.verticalCenter: parent.verticalCenter
43      anchors.margins: constants.margins
44      color: highlighted
45             ? constants.highlightedTextColor :constants.textColor
46      rightPadding: listItem.spacing
47      text: listItem.text
48      font: listItem.font
49      elide: Text.ElideRight
50      visible: listItem.text
51      horizontalAlignment: Text.AlignLeft
52      verticalAlignment: Text.AlignVCenter
53    }
54    Item {
55      id: controlContainer
56      property Item control
57      width: control ? control.width : undefined
58      height: control ? control.height : undefined
59      anchors.right: progression ? progressionImage.left : parent.right
60      anchors.verticalCenter: parent.verticalCenter
61      anchors.margins: constants.margins
62      onControlChanged: {
63        if (control) control.parent = controlContainer;
64      }
65    }
66    Text {
67      id: progressionImage
68      anchors.right: parent.right
69      anchors.verticalCenter: parent.verticalCenter
70      anchors.margins: constants.margins
71      font.family: materialFont.name
72      font.pixelSize: 24
73      text: ">"
74      color: highlighted
75             ? constants.highlightedTextColor :constants.textColor
76      visible: progression
77    }
78  }
79}
80