| 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 |
import Lomiri.Components 1.2 |
| 19 |
|
| 20 |
/*! |
| 21 |
\qmltype Caption |
| 22 |
\inqmlmodule Lomiri.Components.ListItems 1.0 |
| 23 |
\ingroup lomiri-listitems |
| 24 |
\brief List item that shows a piece of text. |
| 25 |
\note \b{The component is deprecated. Use ListItem and Captiopns components instead.} |
| 26 |
|
| 27 |
Examples: |
| 28 |
\qml |
| 29 |
import Lomiri.Components.ListItems 1.0 as ListItem |
| 30 |
Column { |
| 31 |
ListItem.Standard { |
| 32 |
text: "Default list item." |
| 33 |
} |
| 34 |
ListItem.Caption { |
| 35 |
text: "This is a caption text, which can span multiple lines." |
| 36 |
} |
| 37 |
} |
| 38 |
\endqml |
| 39 |
*/ |
| 40 |
Item { |
| 41 |
height: captionText.contentHeight + units.gu(2) * 2 |
| 42 |
width: parent ? parent.width : units.gu(31) |
| 43 |
|
| 44 |
/*! |
| 45 |
The text that is shown in the list item as a label. |
| 46 |
\qmlproperty string text |
| 47 |
*/ |
| 48 |
property alias text: captionText.text |
| 49 |
|
| 50 |
Label { |
| 51 |
id: captionText |
| 52 |
anchors { |
| 53 |
verticalCenter: parent.verticalCenter |
| 54 |
left: parent.left |
| 55 |
right: parent.right |
| 56 |
//Margins are currently hardcoded to avoid adding new API |
| 57 |
leftMargin: units.gu(2) |
| 58 |
rightMargin: units.gu(2) |
| 59 |
} |
| 60 |
wrapMode: Text.Wrap |
| 61 |
color: Theme.palette.normal.backgroundText |
| 62 |
horizontalAlignment: Text.AlignLeft |
| 63 |
fontSize: "small" |
| 64 |
} |
| 65 |
} |