on 8a93021 help sign in
64 lines 1.7 kB history raw
1/*
2 * Copyright (C) 2013,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 */
17import QtQuick 2.0
18import QtQuick.Layouts 1.1
19import Ubuntu.Components 0.1
21Item {
22 property alias text: label.text
23 property alias color: label.color
24 property alias iconName: icon.name
26 signal clicked(variant mouse)
28 height: units.gu(5)
30 RowLayout {
31 spacing: units.gu(.5)
32 anchors {
33 left: parent.left
34 right: parent.right
35 verticalCenter: parent.verticalCenter
36 margins: units.gu(1)
37 }
39 Label {
40 id: label
41 Layout.fillWidth: true
43 font.family: "Ubuntu"
44 fontSize: "medium"
45 elide: Text.ElideRight
46 maximumLineCount: 1
47 textFormat: Text.PlainText
48 width: Math.min(parent.width - units.gu(4), implicitWidth)
49 }
51 Icon {
52 id: icon
53 visible: name != ""
54 height: units.gu(2)
55 width: height
56 color: label.color
57 }
58 }
60 MouseArea {
61 anchors.fill: parent
62 onClicked: parent.clicked(mouse)
63 }