2
* Copyright (C) 2014 Canonical, Ltd.
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.
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.
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/>.
18
import Ubuntu.Components 0.1
19
import "../../Components"
21
/*! \brief Preview widget for text.
23
This widget shows text contained in widgetData["text"]
24
along with a title that comes from widgetData["title"].
26
In case the text does not fit in 7 lines a See More / Less widget is also shown.
31
implicitHeight: childrenRect.height
35
objectName: "titleLabel"
41
color: Theme.palette.selected.backgroundText
44
text: widgetData["title"] || ""
50
objectName: "textLabel"
52
readonly property int maximumCollapsedLineCount: 7
57
top: titleLabel.visible ? titleLabel.bottom : parent.top
59
height: (!seeMore.visible || seeMore.more) ? contentHeight : contentHeight / lineCount * (maximumCollapsedLineCount - 2)
62
color: Theme.palette.selected.backgroundText
64
text: widgetData["text"]
68
UbuntuNumberAnimation {}
79
topMargin: units.gu(1)
81
visible: textLabel.lineCount > textLabel.maximumCollapsedLineCount