on a67b0cb help sign in
unity8/Components/TileStyle.qml
81 lines 2.4 kB history raw
1/*
2 * Copyright (C) 2013 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 */
17import QtQuick 2.0
18import Ubuntu.Components 0.1
20Item {
21 id: tile
23 anchors.fill: parent
25 UbuntuShape {
26 id: icon
27 anchors {
28 top: parent.top
29 horizontalCenter: parent.horizontalCenter
30 }
31 radius: "medium"
32 width: styledItem.imageWidth
33 height: styledItem.imageHeight
34 image: Image {
35 id: image
36 objectName: "image"
37 sourceSize { width: icon.width; height: icon.height }
38 asynchronous: true
39 cache: false
40 source: styledItem.source
41 fillMode: styledItem.fillMode
42 horizontalAlignment: Image.AlignHCenter
43 verticalAlignment: Image.AlignVCenter
44 }
45 }
47 UbuntuShape {
48 id: borderPressed
49 objectName: "borderPressed"
51 anchors.fill: icon
52 radius: "medium"
53 borderSource: "radius_pressed.sci"
54 opacity: styledItem.pressed ? 1.0 : 0.0
55 Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
56 }
58 Label {
59 id: label
60 objectName: "label"
61 anchors {
62 baseline: icon.bottom
63 baselineOffset: units.gu(2)
64 left: parent.left
65 right: parent.right
66 leftMargin: units.gu(1)
67 rightMargin: units.gu(1)
68 }
70 color: Theme.palette.selected.backgroundText
71 opacity: 0.9
72 style: Text.Raised
73 styleColor: "black"
74 fontSize: "small"
75 elide: Text.ElideMiddle
76 horizontalAlignment: styledItem.horizontalAlignment
77 text: styledItem.text
78 wrapMode: Text.Wrap
79 maximumLineCount: styledItem.maximumLineCount
80 }