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  height: visible ? implicitHeight : 0
41  fontSize: "large"
42  // TODO karni: Yet another fix requiring Palette update.
43  color: "grey" //Theme.palette.selected.backgroundText
44  visible: text !== ""
45  opacity: .8
46  text: widgetData["title"] || ""
47  wrapMode: Text.Wrap
48  }
49 
50  Label {
51  id: textLabel
52  objectName: "textLabel"
53 
54  readonly property int maximumCollapsedLineCount: 7
55 
56  anchors {
57  left: parent.left
58  right: parent.right
59  top: titleLabel.visible ? titleLabel.bottom : parent.top
60  }
61  height: (!seeMore.visible || seeMore.more) ? contentHeight : contentHeight / lineCount * (maximumCollapsedLineCount - 2)
62  clip: true
63  fontSize: "small"
64  lineHeight: 1.2
65  // TODO karni: Yet another fix requiring Palette update.
66  color: "grey" //Theme.palette.selected.backgroundText
67  opacity: .8
68  text: widgetData["text"]
69  wrapMode: Text.Wrap
70 
71  Behavior on height {
72  UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration }
73  }
74  }
75 
76  SeeMore {
77  id: seeMore
78  objectName: "seeMore"
79  anchors {
80  left: parent.left
81  right: parent.right
82  top: textLabel.bottom
83  topMargin: visible ? units.gu(1) : 0
84  }
85  height: visible ? implicitHeight : 0
86  visible: textLabel.lineCount > textLabel.maximumCollapsedLineCount
87  }
88 }