Unity 8
 All Classes Functions Properties
PreviewTextSummary.qml
1 /*
2  * Copyright (C) 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.0
18 import Ubuntu.Components 0.1
19 import "../../Components"
20 
30  id: root
31  implicitHeight: childrenRect.height
32 
33  Label {
34  id: titleLabel
35  objectName: "titleLabel"
36  anchors {
37  left: parent.left
38  right: parent.right
39  }
40  fontSize: "large"
41  // TODO karni: Yet another fix requiring Palette update.
42  color: "grey" //Theme.palette.selected.backgroundText
43  visible: text !== ""
44  opacity: .8
45  text: widgetData["title"] || ""
46  wrapMode: Text.Wrap
47  }
48 
49  Label {
50  id: textLabel
51  objectName: "textLabel"
52 
53  readonly property int maximumCollapsedLineCount: 7
54 
55  anchors {
56  left: parent.left
57  right: parent.right
58  top: titleLabel.visible ? titleLabel.bottom : parent.top
59  }
60  height: (!seeMore.visible || seeMore.more) ? contentHeight : contentHeight / lineCount * (maximumCollapsedLineCount - 2)
61  clip: true
62  fontSize: "small"
63  lineHeight: 1.2
64  // TODO karni: Yet another fix requiring Palette update.
65  color: "grey" //Theme.palette.selected.backgroundText
66  opacity: .8
67  text: widgetData["text"]
68  wrapMode: Text.Wrap
69 
70  Behavior on height {
71  UbuntuNumberAnimation {}
72  }
73  }
74 
75  SeeMore {
76  id: seeMore
77  objectName: "seeMore"
78  anchors {
79  left: parent.left
80  right: parent.right
81  top: textLabel.bottom
82  topMargin: units.gu(1)
83  }
84  visible: textLabel.lineCount > textLabel.maximumCollapsedLineCount
85  }
86 }