on cdc76fd help sign in
unity8/qml/Components/PinPadButton.qml
76 lines 2.1 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: root
22 opacity: enabled ? 1 : 0.6
24 property alias text: label.text
25 property alias subText: subTextLabel.text
26 property string iconName
28 signal clicked()
30 Column {
31 anchors.centerIn: parent
32 width: parent.width
33 height: childrenRect.height
35 Item {
36 anchors {
37 left: parent.left
38 right: parent.right
39 }
40 height: label.visible || icon.visible ? Math.max(label.height, icon.height) : 0
42 Label {
43 id: label
44 anchors.centerIn: parent
45 width: parent.width
46 horizontalAlignment: Text.AlignHCenter
47 color: "#f3f3e7"
48 fontSize: "large"
49 font.weight: Font.DemiBold
50 visible: text.length > 0
51 }
53 Icon {
54 id: icon
55 height: units.gu(3)
56 width: height
57 anchors.centerIn: parent
58 name: root.iconName
59 color: "#f3f3e7"
60 visible: name.length > 0
61 }
62 }
63 Label {
64 id: subTextLabel
65 fontSize: "small"
66 color: "#f3f3e7"
67 anchors.horizontalCenter: parent.horizontalCenter
68 visible: text.length > 0
69 }
70 }
72 MouseArea {
73 anchors.fill: parent
74 onClicked: root.clicked()
75 }