on 5bc8421 help sign in
unity8/Components/Tile.qml
87 lines 2.5 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
20AbstractButton {
21 id: root
22 property alias source: image.source
23 property alias fillMode: image.fillMode
24 property alias horizontalAlignment: image.horizontalAlignment
25 property alias verticalAlignment: image.verticalAlignment
26 property alias text: label.text
27 property int imageWidth
28 property int imageHeight
30 UbuntuShape {
31 id: icon
32 anchors {
33 top: parent.top
34 horizontalCenter: parent.horizontalCenter
35 }
36 radius: "medium"
37 width: imageWidth
38 height: imageHeight
39 image: Image {
40 id: image
41 objectName: "image"
42 sourceSize { width: icon.width; height: icon.height }
43 asynchronous: true
44 cache: false
45 }
46 }
48 UbuntuShape {
49 id: borderPressed
50 objectName: "borderPressed"
52 anchors.fill: icon
53 radius: "medium"
54 borderSource: "radius_pressed.sci"
55 opacity: root.pressed ? 1.0 : 0.0
56 Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
57 }
59 Item {
60 anchors {
61 left: parent.left
62 right: parent.right
63 top: icon.bottom
64 }
65 height: units.gu(2)
67 Label {
68 id: label
69 objectName: "label"
70 anchors {
71 baseline: parent.bottom
72 left: parent.left
73 right: parent.right
74 leftMargin: units.gu(1)
75 rightMargin: units.gu(1)
76 }
78 color: Theme.palette.selected.backgroundText
79 opacity: 0.9
80 style: Text.Raised
81 styleColor: "black"
82 fontSize: "small"
83 elide: Text.ElideMiddle
84 horizontalAlignment: Text.AlignHCenter
85 }
86 }