| 1 |
/* |
| 2 |
* Copyright 2012 Canonical Ltd. |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU Lesser 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 Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
import QtQuick 2.4 |
| 18 |
|
| 19 |
/*! |
| 20 |
\qmltype SingleValue |
| 21 |
\inqmlmodule Lomiri.Components.ListItems 1.0 |
| 22 |
\ingroup lomiri-listitems |
| 23 |
\brief A list item displaying a single value |
| 24 |
\note \b{The component is deprecated. Use ListItem component instead.} |
| 25 |
|
| 26 |
Examples: |
| 27 |
\qml |
| 28 |
import Lomiri.Components.ListItems 1.0 as ListItem |
| 29 |
Column { |
| 30 |
ListItem.SingleValue { |
| 31 |
text: "Label" |
| 32 |
value: "Status" |
| 33 |
onClicked: selected = !selected |
| 34 |
} |
| 35 |
ListItem.SingleValue { |
| 36 |
text: "Label" |
| 37 |
iconName: "compose" |
| 38 |
value: "Parameter" |
| 39 |
progression: true |
| 40 |
onClicked: print("clicked") |
| 41 |
} |
| 42 |
} |
| 43 |
\endqml |
| 44 |
*/ |
| 45 |
Base { |
| 46 |
id: listItem |
| 47 |
|
| 48 |
/*! |
| 49 |
The text that is shown in the list item as a label. |
| 50 |
\qmlproperty string text |
| 51 |
*/ |
| 52 |
|
| 53 |
/*! |
| 54 |
\qmlproperty string value |
| 55 |
The values that will be shown next to the label text |
| 56 |
*/ |
| 57 |
property alias value: valueLabel.text |
| 58 |
|
| 59 |
LabelVisual { |
| 60 |
id: label |
| 61 |
selected: listItem.selected |
| 62 |
anchors { |
| 63 |
verticalCenter: parent.verticalCenter |
| 64 |
left: parent.left |
| 65 |
} |
| 66 |
text: listItem.text |
| 67 |
width: Math.min(implicitWidth, parent.width * 0.8) |
| 68 |
} |
| 69 |
LabelVisual { |
| 70 |
id: valueLabel |
| 71 |
selected: listItem.selected |
| 72 |
anchors { |
| 73 |
verticalCenter: parent.verticalCenter |
| 74 |
right: parent.right |
| 75 |
left: label.right |
| 76 |
leftMargin: listItem.__contentsMargins |
| 77 |
} |
| 78 |
horizontalAlignment: Text.AlignRight |
| 79 |
fontSize: "medium" |
| 80 |
} |
| 81 |
} |